home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / OWLINC.PAK / WINDOW.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  75KB  |  3,023 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1991, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.38  $
  6. //
  7. // Base window class TWindow definition, including HWND encapsulation.
  8. //----------------------------------------------------------------------------
  9. #if !defined(OWL_WINDOW_H)
  10. #define OWL_WINDOW_H
  11.  
  12. #if !defined(OWL_DEFS_H)
  13. # include <owl/defs.h>
  14. #endif
  15. #if !defined(WINSYS_WSYSCLS_H)
  16. # include <winsys/wsyscls.h>
  17. #endif
  18. #if !defined(WINSYS_COLOR_H)
  19. # include <winsys/color.h>
  20. #endif
  21. #if !defined(CLASSLIB_OBJSTRM_H)
  22. # include <classlib/objstrm.h>
  23. #endif
  24. #if !defined(OWL_CLIPBOAR_H)
  25. # include <owl/clipboar.h>
  26. #endif
  27. #if !defined(OWL_WINDOWEV_H)
  28. # include <owl/windowev.h>
  29. #endif
  30. #if !defined(OWL_APPLICAT_H)
  31. # include <owl/applicat.h>
  32. #endif
  33. #if !defined(OWL_MENU_H)
  34. # include <owl/menu.h>
  35. #endif
  36. #include <owl/window.rh>
  37.  
  38. #if defined(BI_NAMESPACE)
  39. namespace OWL {
  40. #endif
  41.  
  42. // Generic definitions/compiler options (eg. alignment) preceeding the
  43. // definition of classes
  44. #include <services/preclass.h>
  45.  
  46. class _OWLCLASS TApplication;
  47. class _OWLCLASS TModule;
  48. class _OWLCLASS TScroller;
  49. class _OWLCLASS TRegion;
  50. class _OWLCLASS TWindow;
  51. class _OWLCLASS TDC;
  52. class _OWLCLASS TNotify;
  53. class _OWLCLASS_RTL TXWindow;
  54.  
  55.  
  56. //
  57. // enum TWindowFlag
  58. // ~~~~ ~~~~~~~~~~~
  59. enum TWindowFlag {
  60.   wfAlias           = 0x0001, // TWindow is an alias to a preexisting HWND
  61.   wfAutoCreate      = 0x0002, // Create the HWND when our parent is created
  62.   wfFromResource    = 0x0004, // Handle comes from HWND created from resource
  63.   wfShrinkToClient  = 0x0008, // Shrink a frame window to its client's size
  64.   wfMainWindow      = 0x0010, // This frame window is the main window
  65.   wfFullyCreated    = 0x0020, // Window is fully created & not being destroyed
  66.   wfStreamTop       = 0x0040, // This window is the topmost one to stream
  67.   wfPredefinedClass = 0x0080, // Window class used was not defined by Owl
  68.   wfTransfer        = 0x0100, // Transfer enabled
  69.   wfUnHidden        = 0x0200, // Used temporarily when destroying MDI child
  70.   wfUnDisabled      = 0x0400, // Used temporarily when destroying MDI child
  71.   wfDeleteOnClose   = 0x0800, // Window is condemned on EvClose
  72.   wfPropagateIdle   = 0x1000, // Pass down IdleAction
  73.   wfModalWindow     = 0x2000, // Was created via TWindow::Execute
  74.   wfDetached        = 0x4000, // Window handle has been detached
  75.   wfInsertAtEdge    = 0x8000  // (Decoration) Window to be inserted against frame's edge
  76. };
  77.  
  78. //
  79. // enum TTransferDirection
  80. // ~~~~ ~~~~~~~~~~~~~~~~~~
  81. // Transfer function flags
  82. //
  83. enum TTransferDirection {
  84.   tdGetData,    // Get data from the window into the buffer
  85.   tdSetData,    // Set data from the buffer into the window
  86.   tdSizeData    // Just query the window data size in bytes
  87. };
  88.  
  89. //
  90. // enum TEventStatus
  91. // ~~~~ ~~~~~~~~~~~~
  92. // Mixin window event implementation return status
  93. //
  94. enum TEventStatus {
  95.   esPartial,    // Additional handlers may be invoked
  96.   esComplete    // No additional handlers are needed
  97. };
  98.  
  99. //
  100. // Special background color flags for EvEraseBkgnd processing
  101. //
  102. #define NoColor TColor::None        // let DefWindowProc erase
  103. #define NoErase TColor::Transparent // don't erase, wait for Paint
  104.  
  105. //
  106. // Windows 3.1 windowsx.h name confict with TWindows::GetFirstChild()
  107. //
  108. #if defined(GetFirstChild)
  109. # undef GetFirstChild(hwnd)
  110. #endif
  111.  
  112. //----------------------------------------------------------------------------
  113.  
  114. //
  115. // Member and non-member action and conditional function types used with
  116. // ForEach and FirstThat.
  117. //
  118. typedef void (*TActionFunc)(TWindow* win, void* param);
  119. typedef bool (*TCondFunc)(TWindow* win, void* param);
  120.  
  121. #if defined(BI_COMP_MSC)
  122. # pragma pointers_to_members(full_generality, virtual_inheritance)
  123. #endif
  124.  
  125. typedef void (TWindow::*TActionMemFunc)(TWindow* win, void* param);
  126. typedef bool (TWindow::*TCondMemFunc)(TWindow* win, void* param);
  127.  
  128. typedef TResult (CALLBACK *TThunkProc)(HWND, uint, TParam1, TParam2);
  129.  
  130. //----------------------------------------------------------------------------
  131.  
  132. //
  133. // class TCommandEnabler
  134. // ~~~~~ ~~~~~~~~~~~~~~~
  135. // Base class for an extensible interface for auto enabling/disabling of
  136. // commands (menu items, tool bar buttons, ...)
  137. //
  138. #if defined(BI_NO_RTTI)
  139. class _OWLCLASS TCommandEnabler : public TStreamableBase {
  140. #else
  141. class _OWLCLASS TCommandEnabler {
  142. #endif
  143.   public:
  144.     TCommandEnabler(uint id, HWND hWndReceiver = 0);
  145.  
  146.     uint GetId() const;
  147.  
  148.     virtual void  Enable(bool enable = true);        // Also sets Handled
  149.     virtual void  SetText(const char far* text) = 0;
  150.  
  151.     // Enumeration describing the 3-states or availability of a command
  152.     //
  153.     enum TCommandState {
  154.       Unchecked,          // Command is not enabled
  155.       Checked,            // Command is enabled
  156.       Indeterminate       // Command is unavaiable
  157.     };
  158.  
  159.     virtual void  SetCheck(int check) = 0;           // Pass one of above enum
  160.  
  161.     bool        SendsCommand() const;
  162.  
  163.     bool        GetHandled();
  164.  
  165.     bool        IsReceiver(HWND hReceiver);
  166.     HWND        GetReceiver() const;
  167.     void        SetReceiver(HWND hReceiver);
  168.  
  169.   protected:
  170.     void        SetHandled();
  171.  
  172.   public_data:
  173.     const uint  Id;
  174.  
  175.   protected_data:
  176.     HWND  HWndReceiver;
  177.  
  178.     // Enumeration describing whether the associated command has been
  179.     // enabled or disabled, and whether the command generates WM_COMMAND
  180.     // messages.
  181.     //
  182.     enum TCommandStatus {
  183.       WasHandled = 1,       // Command was enabled or disabled
  184.       NonSender = 2         // Command does not generate WM_COMMAND messages
  185.     };
  186.  
  187.     union {
  188. #if defined(OWL2_COMPAT)
  189.       uint        Handled; // Old name
  190. #endif
  191.       uint        Flags;   // New name
  192.     };
  193.  
  194.   DECLARE_CASTABLE;
  195. };
  196.  
  197. //
  198. // struct TWindowsAttr
  199. // ~~~~~~ ~~~~~~~~~~~~
  200. // Window *Creation* attributes. Don't rely on these to track once Handle
  201. // has been created, use member functions to access information.
  202. //
  203. struct TWindowAttr {
  204.     uint32     Style;
  205.     uint32     ExStyle;
  206.     int        X;
  207.     int        Y;
  208.     int        W;
  209.     int        H;
  210.     TResId     Menu;        // Menu resource id
  211.     int        Id;          // Child identifier
  212.     char far*  Param;
  213.     TResId     AccelTable;  // Accelerator table resource id
  214. };
  215.  
  216. //
  217. // class TWindow
  218. // ~~~~~ ~~~~~~~
  219. class _OWLCLASS TWindow : virtual public TEventHandler,
  220.                           virtual public TStreamableBase {
  221.   public:
  222.     // Class scoped types
  223.     //
  224.     typedef HWND THandle;  // TWindow encapsulates an HWND
  225.  
  226.     // Constructors and destructor for TWindow
  227.     //
  228.     TWindow(TWindow* parent, const char far* title = 0, TModule* module = 0);
  229.     TWindow(HWND handle, TModule* module = 0);
  230.  
  231.     virtual ~TWindow();
  232.  
  233.     // Two iterators that take function pointers
  234.     //
  235.     TWindow*          FirstThat(TCondFunc test, void* paramList = 0) const;
  236.     void              ForEach(TActionFunc action, void* paramList = 0);
  237.  
  238.     // Two iterators that take pointers to member functions
  239.     //
  240.     TWindow*          FirstThat(TCondMemFunc test, void* paramList = 0);
  241.     void              ForEach(TActionMemFunc action, void* paramList = 0);
  242.  
  243.     // Other functions for iteration
  244.     //
  245.     TWindow*          Next();
  246.     void              SetNext(TWindow* next);
  247.     TWindow*          GetFirstChild();
  248.     TWindow*          GetLastChild();
  249.     TWindow*          Previous();
  250.     uint              NumChildren() const;   // Number of child windows
  251.  
  252.     // Query and set the Owl window flags. Accepts TWindowFlag args, possibly
  253.     // or'd together.
  254.     //
  255.     void              SetFlag(uint mask);
  256.     void              ClearFlag(uint mask);
  257.     bool              IsFlagSet(uint mask);
  258.  
  259.     // Sets/clears flag which indicates that the TWindow should be
  260.     // created if a create is sent while in the parent's child list
  261.     //
  262.     void              EnableAutoCreate();
  263.     void              DisableAutoCreate();
  264.  
  265.     // Sets/clears flag which indicates that the TWindow can/will transfer data
  266.     // via the transfer mechanism
  267.     //
  268.     void              EnableTransfer();
  269.     void              DisableTransfer();
  270.  
  271.     // Window's default module access functions
  272.     //
  273.     TModule*          GetModule() const;
  274.     void              SetModule(TModule* module);
  275.  
  276.     TApplication*     GetApplication() const;
  277.     WNDPROC           GetThunk() const;
  278.     virtual bool      Register();
  279.  
  280.     TScroller*        GetScroller();
  281.     void              SetScroller(TScroller* scroller);
  282.  
  283.     // Create/destroy an native window to be associated with this window
  284.     //
  285.     virtual bool      Create();
  286.     virtual void      PerformCreate(int menuOrId);
  287.     bool              CreateChildren();
  288.     virtual void      Destroy(int retVal = 0);
  289.  
  290.     // Create a modal window, and perform actual modal execute call
  291.     //
  292.     virtual int       Execute();
  293.     virtual int       DoExecute();
  294.  
  295.     // Request this window to close itself
  296.     //
  297.     virtual void      CloseWindow(int retVal = 0);
  298.  
  299.     // Unconditionally shut down a given window. Destroy() is called to
  300.     // destroy the Handle, & then the window is deleted. Non-static version
  301.     // is safe as long as it is inline and not called on itself
  302.     //
  303.     static void       ShutDownWindow(TWindow* win, int retVal = 0);
  304.     void              ShutDownWindow(int retVal = 0);
  305.  
  306.     // Attach or detach a window handle to a TWindow object.  Used when
  307.     // a child re-creates itself.
  308.     //
  309.     void              AttachHandle(HWND handle);
  310.     void              DetachHandle();
  311.  
  312. #if defined(BI_MULTI_THREAD_RTL)
  313.     // Override TEventHandler::Dispatch() to handle multi-thread
  314.     // synchronization
  315.     //
  316.     virtual TResult  Dispatch(TEventInfo& info, TParam1 wp, TParam2 lp = 0);
  317. #endif
  318.  
  319.     // Called from TApplication::ProcessAppMsg() to give the window an
  320.     // opportunity to perform preprocessing of the Windows message
  321.     //
  322.     virtual bool      PreProcessMsg(MSG& msg);
  323.     virtual bool      IdleAction(long idleCount);
  324.     virtual bool      HoldFocusHWnd(HWND hLose, HWND hGain);
  325.  
  326.     // Child and parenting
  327.     //
  328.     int               GetId() const;
  329.     TWindow*          ChildWithId(int id) const;
  330.  
  331.     // Get this window's parent. Either the handle of native window, or a
  332.     // pointer to the OWL object. May return different objects in some cases.
  333.     // Use H & O varieties to avoid change across version
  334.     //
  335.     HWND           GetParentH() const; // Native handle version
  336.     TWindow*          GetParentO() const; // OWL object version
  337. #if defined(OWL2_COMPAT)
  338.     HWND           GetParent() const;  // Old version -- returns handle
  339. #else
  340.     TWindow*          GetParent();        // New version -- returns object
  341. #endif
  342.  
  343.     virtual void      SetParent(TWindow* newParent);
  344.  
  345.     // Other attributes
  346.     //
  347.     virtual bool      SetDocTitle(const char far* docname, int index);
  348.     void              SetCaption(const char far* title);
  349.     bool              SetCursor(TModule* module, TResId resId);
  350.     void              SetBkgndColor(const TColor& color);
  351.     void              SetAcceleratorTable(TResId resId);
  352.  
  353.     // Can close virtual tests whether all children and this window are ready
  354.     // and able to close
  355.     //
  356.     virtual bool      CanClose();
  357.  
  358.     // Forwards the current event to "handle" using either PostMessage() or
  359.     // SendMessage(). Owl window version calls directly to window proc on send.
  360.     //
  361.     TResult           ForwardMessage(HWND handle, bool send = true);
  362.     TResult           ForwardMessage(bool send = true);
  363.  
  364.     // Send message to all children
  365.     //
  366.     void              ChildBroadcastMessage(uint msg, TParam1 wParam=0, TParam2 lParam=0);
  367.  
  368.     // Notify a window (parent usually) of a child action.
  369.     //
  370.     void              SendNotification(int id, int notifyCode, HWND hCtl,
  371.                                        uint msg = WM_COMMAND);
  372.     void              SendNotification(HWND receiver, int id,
  373.                                        int notifyCode, HWND hCtl,
  374.                                        uint msg = WM_COMMAND);
  375.     uint32            SendNotification(int id, NMHDR& nmhdr,
  376.                                        uint msg = WM_NOTIFY);
  377.     uint32            SendNotification(HWND receiver, uint id,
  378.                                        NMHDR& nmhdr, uint msg = WM_NOTIFY);
  379.  
  380.     // Called from StdWndProc to allow exceptions to be caught and suspended.
  381.     // Calls HandleMessage from within try block. Catches and suspends all
  382.     // exceptions before returning to Windows (Windows is not exception safe).
  383.     //
  384.     TResult           ReceiveMessage(uint msg, TParam1 p1 = 0, TParam2 p2 = 0);
  385.  
  386.     // Call a Window's window proc to handle a message. Similar to SendMessage
  387.     // but goes directly to Owl window, bypassing windows.
  388.     //
  389.     TResult           HandleMessage(uint msg, TParam1 p1 = 0, TParam2 p2 = 0);
  390.  
  391.     // Virtual functions called to handle a message, and to deal with an
  392.     // unhandled message in a default way.
  393.     //
  394.     virtual TResult   WindowProc(uint msg, TParam1 p1, TParam2 p2);
  395.     virtual TResult   DefWindowProc(uint msg, TParam1 p1, TParam2 p2);
  396.  
  397.     // Called by WindowProc() to handle WM_COMMANDs
  398.     //
  399.     virtual TResult   EvCommand(uint id, HWND hWndCtl, uint notifyCode);
  400.  
  401.     // Called by WindowProc() to handle WM_NOTIFYs
  402.     //
  403.     virtual TResult   EvNotify(uint id, TNotify far& notifyInfo);
  404.  
  405.     // Called by WindowProc() to handle WM_COMMAND_ENABLE, & helper function
  406.     //
  407.     virtual void      EvCommandEnable(TCommandEnabler& ce);
  408.     void              RouteCommandEnable(HWND hInitCmdTarget, TCommandEnabler& ce);
  409.  
  410.     // Default processing, deals with special cases or calls DefWindowProc
  411.     //
  412.     TResult           DefaultProcessing();
  413.  
  414.     // Paint function called by base classes when responding to WM_PAINT
  415.     //
  416.     virtual void      Paint(TDC& dc, bool erase, TRect& rect);
  417.  
  418.     // Transfer buffer functionality
  419.     //
  420.     void              SetTransferBuffer(void* transferBuffer);
  421.     virtual uint      Transfer(void* buffer, TTransferDirection direction);
  422.     virtual void      TransferData(TTransferDirection direction);
  423.  
  424.     // Installs the thunk as the window function and saves the previous window
  425.     // function in "DefaultProc"
  426.     //
  427.     void              SubclassWindowFunction();
  428.  
  429.     //-----------------------------------
  430.     // Encapsulated native HWND functions inline
  431.     //
  432.  
  433.     // Allow a TWindow& to be used as an HWND in Windows API calls
  434.     //
  435.     HWND           GetHandle() const;
  436.     operator          HWND() const;
  437.     bool              IsWindow() const;
  438.  
  439.     // Messages
  440.     //
  441.     TResult           SendMessage(uint msg, TParam1 p1 = 0, TParam2 p2 = 0);
  442.     TResult           SendDlgItemMessage(int childId, uint msg, TParam1 p1 = 0,
  443.                                          TParam2 p2 = 0);
  444.     bool              PostMessage(uint msg, TParam1 p1 = 0, TParam2 p2 = 0);
  445.     static HWND    GetCapture();
  446.     HWND           SetCapture();
  447.     static void       ReleaseCapture();
  448.     static HWND    GetFocus();
  449.     HWND           SetFocus();
  450.     bool              IsWindowEnabled() const;
  451.     virtual bool      EnableWindow(bool enable);
  452.     void              SetRedraw(bool redraw);
  453.  
  454.     // Window coordinates, dimensions...
  455.     //
  456.     void              ScreenToClient(TPoint& point) const;
  457.     void              MapWindowPoints(HWND hWndTo, TPoint* pts, int count) const;
  458.     void              GetClientRect(TRect& rect) const;
  459.     TRect             GetClientRect() const;
  460.     static HWND    WindowFromPoint(const TPoint& point);
  461.     HWND           ChildWindowFromPoint(const TPoint& point) const;
  462.     void              ClientToScreen(TPoint& point) const;
  463.     void              GetWindowRect(TRect& rect) const;
  464.     TRect             GetWindowRect() const;
  465.     static void       AdjustWindowRect(TRect& rect, uint32 style, bool menu);
  466.     static void       AdjustWindowRectEx(TRect& rect, uint32 style,
  467.                                          bool  menu,  uint32 exStyle);
  468.  
  469.     // Window and class Words and Longs, window properties
  470.     //
  471.     long              GetClassName(char far* className, int maxCount) const;
  472.     long              GetClassLong(int index) const;
  473.     long              SetClassLong(int index, long newLong);
  474.     uint16            GetClassWord(int index) const;
  475.     uint16            SetClassWord(int index, uint16 newWord);
  476.     long              GetWindowLong(int index) const;
  477.     long              SetWindowLong(int index, long newLong);
  478.     uint16            GetWindowWord(int index) const;
  479.     uint16            SetWindowWord(int index, uint16 newWord);
  480.     WNDPROC           GetWindowProc() const;
  481.     WNDPROC           SetWindowProc(WNDPROC wndProc);
  482.     int               EnumProps(PROPENUMPROC proc);
  483.     HANDLE            GetProp(uint16 atom) const;
  484.     HANDLE            RemoveProp(uint16 atom) const;
  485.     bool              SetProp(uint16 atom, HANDLE data) const;
  486.     HANDLE            GetProp(const char far* str) const;
  487.     HANDLE            RemoveProp(const char far* str) const;
  488.     bool              SetProp(const char far* str, HANDLE data) const;
  489.  
  490.     // Dual mode accessors. Work with Attr and other members as well as the
  491.     // underlying window information
  492.     //
  493.     uint32            GetStyle() const;
  494.     uint32            SetStyle(uint32 style);
  495.     uint32            GetExStyle() const;
  496.     uint32            SetExStyle(uint32 style);
  497.     bool              ModifyStyle(uint32 offBits, uint32 onBits,
  498.                                   uint swpFlags = 0);
  499.     bool              ModifyExStyle(uint32 offBits, uint32 onBits,
  500.                                     uint swpFlags = 0);
  501.  
  502.     // Window placement(X,Y) and display
  503.     //
  504.     bool              MoveWindow(int x, int y, int w, int h, bool repaint = false);
  505.     bool              MoveWindow(const TRect& rect, bool repaint = false);
  506.     virtual bool      ShowWindow(int cmdShow);
  507.     void              ShowOwnedPopups(bool show);
  508.     bool              IsWindowVisible() const;
  509.     bool              IsZoomed() const;
  510.     bool              IsIconic() const;
  511.     int               GetWindowTextLength() const;
  512.     int               GetWindowText(char far* str, int maxCount) const;
  513.     void              SetWindowText(const char far* str);
  514.     bool              GetWindowPlacement(WINDOWPLACEMENT* place) const;
  515.     bool              SetWindowPlacement(const WINDOWPLACEMENT* place);
  516.  
  517.     // Window positioning(Z), sibling relationships
  518.     //
  519.     void              BringWindowToTop();
  520.     static HWND    GetActiveWindow();
  521.     HWND           SetActiveWindow();
  522.     static HWND    GetDesktopWindow();
  523. #if defined(BI_PLAT_WIN16)
  524.     static HWND    GetSysModalWindow();
  525.     HWND           SetSysModalWindow();
  526. #endif
  527.     HWND           GetLastActivePopup() const;
  528.     HWND           GetNextWindow(uint dirFlag) const;
  529.     HWND           GetTopWindow() const;
  530.     HWND           GetWindow(uint cmd) const;
  531.     bool              SetWindowPos(HWND      hWndInsertAfter,
  532.                                    const TRect& rect,
  533.                                    uint         flags);
  534.     bool              SetWindowPos(HWND      hWndInsertAfter,
  535.                                    int x, int y, int w, int h,
  536.                                    uint         flags);
  537.  
  538.     // Window painting: invalidating, validating & updating
  539.     //
  540.     void              Invalidate(bool erase = true);
  541.     void              InvalidateRect(const TRect& rect, bool erase = true);
  542.     void              InvalidateRgn(HRGN hRgn, bool erase = true);
  543.     void              Validate();
  544.     void              ValidateRect(const TRect& rect);
  545.     void              ValidateRgn(HRGN hRgn);
  546.     void              UpdateWindow();
  547.     bool              FlashWindow(bool invert);
  548.     bool              GetUpdateRect(TRect& rect, bool erase = true) const;
  549.     bool              GetUpdateRgn(TRegion& rgn, bool erase = true) const;
  550.     bool              LockWindowUpdate();
  551.     bool              RedrawWindow(TRect* update,
  552.                                    HRGN   hUpdateRgn,
  553.                                    uint   redrawFlags = RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
  554.  
  555.     // Scrolling and scrollbars
  556.     //
  557.     int               GetScrollPos(int bar) const;
  558.     int               SetScrollPos(int bar, int pos, bool redraw = true);
  559.     void              GetScrollRange(int bar, int& minPos, int& maxPos) const;
  560.     void              SetScrollRange(int  bar,
  561.                                      int  minPos,
  562.                                      int  maxPos,
  563.                                      bool redraw = true);
  564.     void              SetScrollPage(int bar, int page, bool redraw = true);
  565.     int               GetScrollPage(int bar) const;
  566.     bool              EnableScrollBar(uint sbFlags=SB_BOTH,
  567.                                       uint arrowFlags=ESB_ENABLE_BOTH);
  568.     void              ShowScrollBar(int bar, bool show = true);
  569.     void              ScrollWindow(int              dx,
  570.                                    int              dy,
  571.                                    const TRect far* scroll = 0,
  572.                                    const TRect far* clip = 0);
  573.     void              ScrollWindowEx(int              dx,
  574.                                      int              dy,
  575.                                      const TRect far* scroll = 0,
  576.                                      const TRect far* clip = 0,
  577.                                      HRGN             hUpdateRgn = 0,
  578.                                      TRect far*       update = 0,
  579.                                      uint             flags = 0);
  580. #if defined(BI_PLAT_WIN32)
  581.     void              SetScrollInfo(int bar, SCROLLINFO* scrollInfo,
  582.                                     bool redraw = true);
  583.     void              GetScrollInfo(int bar, SCROLLINFO* scrollInfo) const;
  584. #endif
  585.  
  586.     // Parent/child with Ids
  587.     //
  588.     int               GetDlgCtrlID() const;
  589.     HWND           GetDlgItem(int childId) const;
  590.     uint              GetDlgItemInt(int   childId,
  591.                                     bool* translated = 0,
  592.                                     bool  isSigned = true) const;
  593.     void              SetDlgItemInt(int  childId,
  594.                                     uint value,
  595.                                     bool isSigned = true) const;
  596.     int               GetDlgItemText(int       childId,
  597.                                      char far* text,
  598.                                      int       max) const;
  599.     void              SetDlgItemText(int childId, const char far* text) const;
  600.     uint              IsDlgButtonChecked(int buttonId) const;
  601.     bool              IsChild(HWND hWnd) const;
  602.     HWND           GetNextDlgGroupItem(HWND hWndCtrl,
  603.                                           bool previous = false) const;
  604.     HWND           GetNextDlgTabItem(HWND hWndCtrl,
  605.                                         bool previous = false) const;
  606.     void              CheckDlgButton(int buttonId, uint check);
  607.     void              CheckRadioButton(int firstButtonId,
  608.                                        int lastButtonId,
  609.                                        int checkButtonId);
  610.  
  611.     // Menus and menubar
  612.     //
  613.     HMENU             GetMenu() const;
  614.     HMENU             GetSystemMenu(bool revert = false) const;
  615.     bool              SetMenu(HMENU hMenu);
  616.     bool              HiliteMenuItem(HMENU hMenu, uint idItem, uint hilite);
  617.     void              DrawMenuBar();
  618.  
  619.     // Timer
  620.     //
  621.     bool              KillTimer(uint timerId);
  622.     uint              SetTimer(uint timerId, uint timeout, TIMERPROC proc = 0);
  623.  
  624.     // Caret, cursor, font
  625.     //
  626.     void              CreateCaret(HBITMAP hBitmap);
  627.     void              CreateCaret(bool isGray, int width, int height);
  628.     static uint       GetCaretBlinkTime();
  629.     static void       GetCaretPos(TPoint& point);
  630.     void              HideCaret();
  631.     static void       SetCaretBlinkTime(uint16 milliSecs);
  632.     static void       SetCaretPos(int x, int y);
  633.     static void       SetCaretPos(const TPoint& pos);
  634.     void              ShowCaret();
  635.     static void       DestroyCaret();
  636.     static void       GetCursorPos(TPoint& pos);
  637.     void              SetWindowFont(HFONT font, bool redraw);
  638.     HFONT             GetWindowFont();
  639.  
  640.     // Hot keys
  641.     //
  642. #if defined(BI_PLAT_WIN32)
  643.     bool              RegisterHotKey(int idHotKey, uint modifiers, uint virtKey);
  644.     bool              UnregisterHotKey(int idHotKey);
  645. #endif
  646.  
  647.     // Misc
  648.     //
  649.     bool              WinHelp(const char far* helpFile,
  650.                               uint            command,
  651.                               uint32          data);
  652.     void              AssignContextMenu(TPopupMenu* menu);
  653.     TPopupMenu*       GetContextMenu() const;
  654.     int               MessageBox(const char far* text,
  655.                                  const char far* caption = 0,
  656.                                  uint            type = MB_OK);
  657.     HTASK             GetWindowTask() const;
  658.     void              DragAcceptFiles(bool accept);
  659.  
  660.     TCurrentEvent&    GetCurrentEvent();
  661.  
  662.   protected:
  663.     // These events are processed by TWindow
  664.     //
  665.     void              EvClose();
  666.     int               EvCreate(CREATESTRUCT far& createStruct);
  667.     void              EvDestroy();
  668.     TResult           EvCompareItem(uint ctrlId, COMPAREITEMSTRUCT far& compareInfo);
  669.     void              EvDeleteItem(uint ctrlId, DELETEITEMSTRUCT far& deleteInfo);
  670.     void              EvDrawItem(uint ctrlId, DRAWITEMSTRUCT far& drawInfo);
  671.     void              EvMeasureItem(uint ctrlId, MEASUREITEMSTRUCT far& measureInfo);
  672.     void              EvHScroll(uint scrollCode, uint thumbPos, HWND hWndCtl);
  673.     void              EvVScroll(uint scrollCode, uint thumbPos, HWND hWndCtl);
  674.     void              EvMove(TPoint& clientOrigin);
  675.     void              EvNCDestroy();
  676.     bool              EvQueryEndSession();
  677.     void              EvSize(uint sizeType, TSize& size);
  678.     void              EvLButtonDown(uint modKeys, TPoint& point);
  679.     bool              EvEraseBkgnd(HDC);
  680.     void              EvPaint();
  681.     void              EvSysColorChange();
  682.     TResult           EvWin32CtlColor(TParam1, TParam2);
  683.  
  684.     // Input validation message handler
  685.     //
  686.     void              EvChildInvalid(HWND hWnd);
  687.  
  688.     // System messages
  689.     //
  690.     void              EvCommNotify(uint commId, uint status);
  691.     void              EvCompacting(uint compactRatio);
  692.     void              EvDevModeChange(char far* devName);
  693.     void              EvEnable(bool enabled);
  694.     void              EvEndSession(bool endSession, bool logOff /* used only by Win95 */);
  695.     void              EvFontChange();
  696.     int               EvPower(uint powerEvent);
  697.     void              EvSysCommand(uint cmdType, TPoint& point);
  698.     void              EvSystemError(uint error);
  699.     void              EvTimeChange();
  700.     void              EvTimer(uint timerId);
  701.     void              EvWinIniChange(char far* section);
  702.  
  703.     // Window manager messages
  704.     //
  705.     void              EvActivate(uint active,
  706.                                  bool minimized,
  707.                                  HWND hWndOther /* may be 0 */);
  708.     void              EvActivateApp(bool active, HTASK hTask);
  709.     void              EvCancelMode();
  710.     void              EvGetMinMaxInfo(MINMAXINFO far& minmaxinfo);
  711.     void              EvGetText(uint buffSize, char far* buff);
  712.     uint              EvGetTextLength();
  713.     void              EvIconEraseBkgnd(HDC hDC);
  714.     void              EvKillFocus(HWND hWndGetFocus /* may be 0 */);
  715.     uint              EvMouseActivate(HWND hTopLevel, uint hitCode, uint msg);
  716.  
  717.     // The following are called under Win32 only
  718.     //
  719.     void              EvInputFocus(bool gainingFocus);
  720.     void              EvOtherWindowCreated(HWND hWndOther);
  721.     void              EvOtherWindowDestroyed(HWND hWndOther);
  722.     void              EvPaintIcon();
  723.     void              EvHotKey(int idHotKey);
  724. #if defined(BI_PLAT_WIN32)
  725.     void              EvCopyData(HWND hwnd, COPYDATASTRUCT* dataStruct);
  726. #endif
  727.  
  728.     void              EvNextDlgCtl(uint hctlOrDir, uint isHCtl);
  729.     void              EvParentNotify(uint event,
  730.                                      uint childHandleOrX,
  731.                                      uint childIDOrY);
  732.     HANDLE            EvQueryDragIcon();
  733.     bool              EvQueryOpen();
  734.     void              EvQueueSync();
  735.     bool              EvSetCursor(HWND hWndCursor,
  736.                                   uint hitTest,
  737.                                   uint mouseMsg);
  738.     void              EvSetFocus(HWND hWndLostFocus /* may be 0 */);
  739.     HFONT             EvGetFont();
  740.     void              EvSetFont(HFONT hFont, bool redraw);
  741.     void              EvSetRedraw(bool redraw);
  742.     void              EvSetText(const char far* text);
  743.     void              EvShowWindow(bool show, uint status);
  744.     void              EvWindowPosChanged(WINDOWPOS far& windowPos);
  745.     void              EvWindowPosChanging(WINDOWPOS far& windowPos);
  746.  
  747.     // Controls
  748.     //
  749.     HBRUSH            EvCtlColor(HDC hDC, HWND hWndChild, uint ctlType);
  750.  
  751.     // Keyboard input
  752.     //
  753.     void              EvChar(uint key, uint repeatCount, uint flags);
  754.     void              EvDeadChar(uint deadKey, uint repeatCount, uint flags);
  755.     void              EvKeyDown(uint key, uint repeatCount, uint flags);
  756.     void              EvKeyUp(uint key, uint repeatCount, uint flags);
  757.     void              EvSysChar(uint key, uint repeatCount, uint flags);
  758.     void              EvSysDeadChar(uint key, uint repeatCount, uint flags);
  759.     void              EvSysKeyDown(uint key, uint repeatCount, uint flags);
  760.     void              EvSysKeyUp(uint key, uint repeatCount, uint flags);
  761.  
  762.     // Mouse input
  763.     //
  764.     void              EvLButtonDblClk(uint modKeys, TPoint& point);
  765.     void              EvLButtonUp(uint modKeys, TPoint& point);
  766.     void              EvMButtonDblClk(uint modKeys, TPoint& point);
  767.     void              EvMButtonDown(uint modKeys, TPoint& point);
  768.     void              EvMButtonUp(uint modKeys, TPoint& point);
  769.     void              EvMouseMove(uint modKeys, TPoint& point);
  770.     void              EvRButtonDblClk(uint modKeys, TPoint& point);
  771.     void              EvRButtonDown(uint modKeys, TPoint& point);
  772.     void              EvRButtonUp(uint modKeys, TPoint& point);
  773.  
  774.     // Menu related messages
  775.     //
  776.     void              EvInitMenu(HMENU hMenu);
  777.     void              EvInitMenuPopup(HMENU hPopupMenu,
  778.                                       uint  index,
  779.                                       bool  sysMenu);
  780.     int32             EvMenuChar(uint nChar, uint menuType, HMENU hMenu);
  781.     void              EvMenuSelect(uint menuItemId, uint flags, HMENU hMenu);
  782.     void              EvContextMenu(HWND childHwnd, int x, int y);
  783.  
  784.     // Dialog [Menu] messages
  785.     //
  786.     uint              EvGetDlgCode(MSG far* msg);
  787.     void              EvEnterIdle(uint source, HWND hWndDlg);
  788.  
  789.     // Print manager messages
  790.     //
  791.     void              EvSpoolerStatus(uint jobStatus, uint jobsLeft);
  792.  
  793.     // Clipboard messages
  794.     //
  795.     void              EvAskCBFormatName(uint bufLen, char far* buffer);
  796.     void              EvChangeCBChain(HWND hWndRemoved, HWND hWndNext);
  797.     void              EvDrawClipboard();
  798.     void              EvDestroyClipboard();
  799.     void              EvHScrollClipboard(HWND hCBViewer, uint scrollCode, uint pos);
  800.     void              EvPaintClipboard(HWND hWnd, HANDLE hPaintStruct);
  801.     void              EvRenderAllFormats();
  802.     void              EvRenderFormat(uint dataFormat);
  803.     void              EvSizeClipboard(HWND hWndViewer, HANDLE hRect);
  804.     void              EvVScrollClipboard(HWND hCBViewer, uint scrollCode, uint pos);
  805.  
  806.     // Palette manager messages
  807.     //
  808.     void              EvPaletteChanged(HWND hWndPalChg);
  809.     void              EvPaletteIsChanging(HWND hWndPalChg);
  810.     bool              EvQueryNewPalette();
  811.  
  812.     // Drag-n-drop messages
  813.     //
  814.     void              EvDropFiles(TDropInfo dropInfo);
  815.  
  816.     // List box messages
  817.     //
  818.     int               EvCharToItem(uint key, HWND hWndListBox, uint caretPos);
  819.     int               EvVKeyToItem(uint key, HWND hWndListBox, uint caretPos);
  820.  
  821.     // Non-client messages
  822.     //
  823.     bool              EvNCActivate(bool active);
  824.     uint              EvNCCalcSize(bool calcValidRects, NCCALCSIZE_PARAMS far& params);
  825.     bool              EvNCCreate(CREATESTRUCT far& createStruct);
  826.     uint              EvNCHitTest(TPoint& point);
  827.     void              EvNCLButtonDblClk(uint hitTest, TPoint& point);
  828.     void              EvNCLButtonDown(uint hitTest, TPoint& point);
  829.     void              EvNCLButtonUp(uint hitTest, TPoint& point);
  830.     void              EvNCMButtonDblClk(uint hitTest, TPoint& point);
  831.     void              EvNCMButtonDown(uint hitTest, TPoint& point);
  832.     void              EvNCMButtonUp(uint hitTest, TPoint& point);
  833.     void              EvNCMouseMove(uint hitTest, TPoint& point);
  834.     void              EvNCRButtonDblClk(uint hitTest, TPoint& point);
  835.     void              EvNCRButtonDown(uint hitTest, TPoint& point);
  836.     void              EvNCRButtonUp(uint hitTest, TPoint& point);
  837.  
  838.     // WM_NCPAINT now passes an HRGN under Win32.
  839.     //
  840. #if defined(BI_PLAT_WIN32)
  841.     void              EvNCPaint(HRGN);
  842. #else
  843.     void              EvNCPaint();
  844. #endif
  845.  
  846.     // Icon messages
  847.     //
  848.     HICON             EvGetIcon(bool largeIcon);
  849.     HICON             EvSetIcon(bool largeIcon, HICON icon);
  850.  
  851.     // Callback procs for hooking TWindow to native window
  852.     //
  853.     static TResult CALLBACK InitWndProc(HWND, uint, TParam1, TParam2);
  854.     static TResult CALLBACK StdWndProc(HWND, uint, TParam1, TParam2);
  855.  
  856.   protected:
  857.     // Constructor & subsequent initializer for use with virtual derivations
  858.     // Immediate derivitives must call Init() before constructions are done.
  859.     //
  860.     TWindow();
  861.     void              Init(TWindow* parent, const char far* title, TModule* module);
  862.     void              Init(HWND hWnd, TModule* module);
  863.  
  864.     // Set the window handle in a derived class. Used by derived classes that
  865.     // create their window handle in a class specific way.
  866.     //
  867.     void              SetHandle(HWND handle);
  868.  
  869.     // Resynching state
  870.     //
  871.     void              GetHWndState(bool forceStyleSync = false);
  872.     void              GetWindowTextTitle();
  873.  
  874.     virtual void      GetWindowClass(WNDCLASS& wndClass);
  875.     virtual char far* GetClassName();
  876.  
  877.     virtual void      SetupWindow();
  878.     virtual void      CleanupWindow();
  879.  
  880.     void              DispatchScroll(uint scrollCode, uint thumbPos, HWND hWndCtrl);
  881.  
  882.     void              LoadAcceleratorTable();
  883.     virtual void      RemoveChild(TWindow* child);
  884.  
  885.     TWindow*          GetWindowPtr(HWND hWnd) const;
  886.  
  887.     // Member data  
  888.     //
  889.   public_data:
  890.     union {
  891. #if defined(OWL2_COMPAT)
  892.       HWND         HWindow;  // Old obsolete name
  893. #endif
  894.       HWND         Handle;   // Handle to associated MS-Windows window
  895.     };
  896.     char far*         Title;    // Logical title. Usually the same as window text
  897.     TWindow*          Parent;   // Owl parent, use GetParentO(), SetParent()
  898.     TWindowAttr       Attr;     // Creation attributes
  899.     WNDPROC           DefaultProc; // Default proc to call if msg not handled
  900.     TScroller*        Scroller; // Scrolling helper object
  901.  
  902.   protected_data:
  903.     void*             TransferBuffer;
  904.     union {
  905. #if defined(OWL2_COMPAT)
  906.       HACCEL          hAccel;
  907. #endif
  908.       HACCEL          HAccel;
  909.     };
  910.     TModule*          CursorModule;
  911.     TResId            CursorResId;
  912.     HCURSOR           HCursor;
  913.     TColor            BkgndColor;
  914.     TPopupMenu*       ContextPopupMenu;   // Popup menu used for right click
  915.  
  916.   private:
  917.     WNDPROC           Thunk;        // Thunk that loads 'this' into registers
  918.     TApplication*     Application;  // Application that this window belongs to
  919.     TModule*          Module;       // Default module used for getting resources
  920.     uint32            Flags;
  921.     uint16            ZOrder;
  922.     TWindow*          ChildList;
  923.     TWindow*          SiblingList;
  924.     uint32            UniqueId;
  925.  
  926.     static uint32     LastUniqueId;
  927.  
  928.     void              Init(TWindow* parent, TModule* module);
  929.     bool              OrderIsI(TWindow* win, void* position);
  930.     void              AssignZOrder();
  931.     void              AddChild(TWindow* child);
  932.     int               IndexOf(TWindow* child) const;
  933.     TWindow*          At(int position);
  934.  
  935.     void              SetUniqueId();
  936.  
  937.     // Hidden to prevent accidental copying or assignment
  938.     //
  939.     TWindow(const TWindow&);
  940.     TWindow& operator =(const TWindow&);
  941.  
  942. #if defined(OWL2_COMPAT)
  943.   // Obsolete members for Owl 2.x compatibility
  944.   //
  945.   public:
  946.     void              Show(int cmdShow);  // Use ShowWindow()
  947.  
  948.     // Obsolete way to open the global clipboard object. The recomended way is
  949.     // to construct a TClipboard using the TClipboard(HWND) ctor
  950.     //
  951.     TClipboard&       OpenClipboard();
  952.     typedef ::TXWindow TXWindow;        // Exceptions moved to global scope
  953. #endif
  954. #if defined(OWL1_COMPAT)
  955.     TStatus        Status;              // Obsolete, use exceptions
  956. #endif
  957.  
  958.   DECLARE_RESPONSE_TABLE(TWindow);
  959.   DECLARE_STREAMABLE(_OWLCLASS, TWindow, 3);
  960.  
  961. };  // class TWindow
  962.  
  963. //
  964. // class TXWindow
  965. // ~~~~~ ~~~~~~~~
  966. // Basic Window exception.
  967. //
  968. class _OWLCLASS_RTL TXWindow : public TXOwl {
  969.   public:
  970.     TXWindow(TWindow* win = 0, uint resourceId = IDS_INVALIDWINDOW);
  971.  
  972.     TXWindow(const TXWindow& src);
  973.     int Unhandled(TModule* app, uint promptResId);
  974.  
  975. #if defined(BI_NO_COVAR_RET)
  976.     TXBase* Clone();
  977. #else
  978.     TXWindow* Clone();
  979. #endif
  980.     void Throw();
  981.  
  982.     static void Raise(TWindow* win = 0, uint resourceId = IDS_INVALIDWINDOW);
  983.  
  984. #if defined(OWL2_COMPAT)
  985.     static string Msg(TWindow* win, uint resourceid);
  986. #endif
  987.  
  988.   public_data:
  989.     TWindow*      Window;
  990. };
  991.  
  992. // Generic definitions/compiler options (eg. alignment) following the
  993. // definition of classes
  994. #include <services/posclass.h>
  995.  
  996. //----------------------------------------------------------------------------
  997.  
  998. //
  999. // A TActionFunc defined in window.cpp
  1000. //
  1001. void DoEnableAutoCreate(TWindow* win, void*);
  1002.  
  1003. //
  1004. // Raw function to retrieve a TWindow pointer given an HWND from the a given
  1005. // app, or any app (app==0). Use the TWindow or TApplication member versions
  1006. // in new code for more protection.
  1007. //
  1008. TWindow* _OWLFUNC GetWindowPtr(HWND hWnd, const TApplication* app = 0);
  1009. #if defined(OWL1_COMPAT)
  1010. inline TWindow* GetObjectPtr(HWND hWnd)
  1011. # if defined(BI_NAMESPACE)
  1012.     {return OWL::GetWindowPtr(hWnd);}
  1013. # else
  1014.     {return ::GetWindowPtr(hWnd);}
  1015. # endif
  1016. #endif
  1017.  
  1018. #if defined(__TRACE) || defined(__WARN)
  1019.   ostream& operator <<(ostream& os, const TWindow& w);
  1020. #endif
  1021.  
  1022. #if defined(BI_NAMESPACE)
  1023. } // namespace OWL
  1024. #endif
  1025.  
  1026. //----------------------------------------------------------------------------
  1027. // Inline implementations
  1028. //
  1029.  
  1030. //
  1031. // Retrieve the id of the command.
  1032. //
  1033. inline uint TCommandEnabler::GetId() const
  1034. {
  1035.   return Id;
  1036. }
  1037.  
  1038. //
  1039. // Return true if this command enabler sends a command message.
  1040. //
  1041. inline bool TCommandEnabler::SendsCommand() const
  1042. {
  1043.   return !(Flags & NonSender);
  1044. }
  1045.  
  1046. //
  1047. // Return true if the command enabler has been handled.
  1048. //
  1049. inline bool TCommandEnabler::GetHandled()
  1050. {
  1051.   return Flags & WasHandled;
  1052. }
  1053.  
  1054. //
  1055. // Return true if the window is the receiver.
  1056. //
  1057. inline bool TCommandEnabler::IsReceiver(HWND hReceiver)
  1058. {
  1059.   return hReceiver == HWndReceiver;
  1060. }
  1061.  
  1062. //
  1063. // Return the handle of the window that this enabler was destined for.
  1064. //
  1065. inline HWND TCommandEnabler::GetReceiver() const
  1066. {
  1067.   return HWndReceiver;
  1068. }
  1069.  
  1070. //
  1071. // Set the receiver for the enabler.
  1072. //
  1073. inline void TCommandEnabler::SetReceiver(HWND hReceiver)
  1074. {
  1075.   HWndReceiver = hReceiver;
  1076. }
  1077.  
  1078. //
  1079. // Mark that the enabler has been handled.
  1080. //
  1081. inline void TCommandEnabler::SetHandled()
  1082. {
  1083.   Flags |= WasHandled;
  1084. }
  1085.  
  1086. //----------------------------------------------------------------------------
  1087. // TWindow inlines
  1088. //
  1089.  
  1090. //
  1091. inline TWindow* TWindow::Next()
  1092. {
  1093.   return SiblingList;
  1094. }
  1095.  
  1096. //
  1097. inline void TWindow::SetNext(TWindow* next)
  1098. {
  1099.   SiblingList = next;
  1100. }
  1101.  
  1102. //
  1103. inline TWindow* TWindow::GetFirstChild()
  1104. {
  1105.   return ChildList ? ChildList->SiblingList : 0;
  1106. }
  1107.  
  1108. //
  1109. inline TWindow* TWindow::GetLastChild()
  1110. {
  1111.   return ChildList;
  1112. }
  1113.  
  1114. //
  1115. inline void TWindow::SetFlag(uint mask)
  1116. {
  1117.   Flags |= uint32(mask);
  1118. }
  1119.  
  1120. //
  1121. inline void TWindow::ClearFlag(uint mask)
  1122. {
  1123.   Flags &= uint32(~mask);
  1124. }
  1125.  
  1126. //
  1127. inline bool TWindow::IsFlagSet(uint mask)
  1128. {
  1129.   return (Flags & mask) ? true : false;
  1130. }
  1131.  
  1132. //
  1133. inline void TWindow::EnableAutoCreate()
  1134. {
  1135.   SetFlag(wfAutoCreate);
  1136. }
  1137.  
  1138. //
  1139. inline void TWindow::DisableAutoCreate()
  1140. {
  1141.   ClearFlag(wfAutoCreate);
  1142. }
  1143.  
  1144. //
  1145. inline void TWindow::EnableTransfer()
  1146. {
  1147.   SetFlag(wfTransfer);
  1148. }
  1149.  
  1150. //
  1151. inline void TWindow::DisableTransfer()
  1152. {
  1153.   ClearFlag(wfTransfer);
  1154. }
  1155.  
  1156. //
  1157. inline TModule* TWindow::GetModule() const
  1158. {
  1159.   return Module;
  1160. }
  1161.  
  1162. //
  1163. inline void TWindow::SetModule(TModule* module)
  1164. {
  1165.   Module = module;
  1166. }
  1167.  
  1168. //
  1169. inline TApplication* TWindow::GetApplication() const
  1170. {
  1171.   return Application;
  1172. }
  1173.  
  1174. //
  1175. inline WNDPROC TWindow::GetThunk() const
  1176. {
  1177.   return Thunk;
  1178. }
  1179.  
  1180. //
  1181. // Return the associated scroller object for this window.
  1182. //
  1183. inline TScroller* TWindow::GetScroller()
  1184. {
  1185.   return Scroller;
  1186. }
  1187.  
  1188. //
  1189. inline void TWindow::ShutDownWindow(int retVal)
  1190. {
  1191.   ShutDownWindow(this, retVal);
  1192. }
  1193.  
  1194. //
  1195. inline int TWindow::GetId() const
  1196. {
  1197.   return Attr.Id;
  1198. }
  1199.  
  1200. //
  1201. inline void TWindow::SetBkgndColor(const TColor& color)
  1202. {
  1203.   BkgndColor = color;
  1204. }
  1205.  
  1206. //
  1207. inline void TWindow::SetTransferBuffer(void* transferBuffer)
  1208. {
  1209.   TransferBuffer = transferBuffer;
  1210. }
  1211.  
  1212. //----------------------------------------------------------------------------
  1213. // HWND wrappers
  1214. //
  1215.  
  1216. //
  1217. // Return the handle of the parent.
  1218. //
  1219. inline HWND TWindow::GetParentH() const
  1220. {
  1221.   return GetHandle() ? ::GetParent(GetHandle()) : 0;
  1222. }
  1223.  
  1224. //
  1225. // Return the OWL's parent for this window.
  1226. //
  1227. inline TWindow* TWindow::GetParentO() const
  1228. {
  1229.   return Parent;
  1230. }
  1231.  
  1232. #if defined(OWL2_COMPAT)
  1233. //
  1234. // For OWL 2 compatability, GetParent returns the handle.
  1235. //
  1236. inline HWND TWindow::GetParent() const
  1237. {
  1238.   return GetParentH();
  1239. }
  1240. #else
  1241. //
  1242. // In the future, GetParent returns the OWL object.
  1243. //
  1244. inline TWindow* TWindow::GetParent()
  1245. {
  1246.   return GetParentO();
  1247. }
  1248. #endif
  1249.  
  1250. //
  1251. // Return the handle of the window.
  1252. //
  1253. inline HWND TWindow::GetHandle() const
  1254. {
  1255.   return Handle;
  1256. }
  1257.  
  1258. //
  1259. inline TWindow::operator HWND() const
  1260. {
  1261.   return GetHandle();
  1262. }
  1263.  
  1264. //
  1265. inline void TWindow::SetHandle(HWND handle)
  1266. {
  1267.   Handle = handle;
  1268. }
  1269.  
  1270. //
  1271. inline bool TWindow::IsWindow() const
  1272. {
  1273.   return ::IsWindow(GetHandle());
  1274. }
  1275.  
  1276. //
  1277. // Return the current event to be processed in the message queue.
  1278. //
  1279. inline TCurrentEvent& TWindow::GetCurrentEvent()
  1280. {
  1281.   return GetApplication()->GetCurrentEvent();
  1282. }
  1283.  
  1284. //
  1285. inline void
  1286. TWindow::SendNotification(int id, int notifyCode, HWND hCtl, uint msg)
  1287. {
  1288. #if defined(BI_PLAT_WIN32)
  1289.   SendMessage(msg, MkParam1(id, notifyCode), TParam2(hCtl));
  1290. #else
  1291.   SendMessage(msg, id, MkParam2(uint16(hCtl), notifyCode));
  1292. #endif
  1293. }
  1294.  
  1295. //
  1296. inline void
  1297. TWindow::SendNotification(HWND receiver, int id, int notifyCode,
  1298.                           HWND hCtl, uint msg)
  1299. {
  1300.   PRECONDITION(receiver && ::IsWindow(receiver));
  1301. #if defined(BI_PLAT_WIN32)
  1302.   ::SendMessage(receiver, msg, MkParam1(id, notifyCode), TParam2(hCtl));
  1303. #else
  1304.   ::SendMessage(receiver, msg, id, MkParam2(uint16(hCtl), notifyCode));
  1305. #endif
  1306. }
  1307.  
  1308. //
  1309. inline uint32
  1310. TWindow::SendNotification(int id, NMHDR& nmhdr, uint msg)
  1311. {
  1312.   return SendMessage(msg, TParam1(id), TParam2(&nmhdr));
  1313. }
  1314.  
  1315. //
  1316. //
  1317. inline uint32
  1318. TWindow::SendNotification(HWND receiver, uint id, NMHDR& nmhdr, uint msg)
  1319. {
  1320.   return ::SendMessage(receiver, msg, TParam1(id), TParam2(&nmhdr));
  1321. }
  1322.  
  1323. //
  1324. // Wrapper for Windows API.
  1325. //
  1326. inline TResult
  1327. TWindow::SendDlgItemMessage(int childId, uint msg, TParam1 p1, TParam2 p2)
  1328.  
  1329. {
  1330.   PRECONDITION(GetHandle());
  1331.   return ::SendDlgItemMessage(GetHandle(), childId, msg, p1, p2);
  1332. }
  1333.  
  1334. //
  1335. // Wrapper for Windows API.
  1336. //
  1337. inline bool
  1338. TWindow::PostMessage(uint msg, TParam1 p1, TParam2 p2)
  1339. {
  1340.   PRECONDITION(GetHandle());
  1341.   return ::PostMessage(GetHandle(), msg, p1, p2);
  1342. }
  1343.  
  1344. //
  1345. // Wrapper for Windows API.
  1346. //
  1347. inline HWND
  1348. TWindow::GetCapture()
  1349. {
  1350.   return ::GetCapture();
  1351. }
  1352.  
  1353. //
  1354. // Wrapper for Windows API.
  1355. //
  1356. inline HWND
  1357. TWindow::SetCapture()
  1358. {
  1359.   PRECONDITION(GetHandle());
  1360.   return ::SetCapture(GetHandle());
  1361. }
  1362.  
  1363. //
  1364. // Wrapper for Windows API.
  1365. //
  1366. inline void
  1367. TWindow::ReleaseCapture()
  1368. {
  1369.   ::ReleaseCapture();
  1370. }
  1371.  
  1372. //
  1373. // Wrapper for Windows API.
  1374. //
  1375. inline HWND
  1376. TWindow::GetFocus()
  1377. {
  1378.   return ::GetFocus();
  1379. }
  1380.  
  1381. //
  1382. // Wrapper for Windows API.
  1383. //
  1384. inline HWND
  1385. TWindow::SetFocus()
  1386. {
  1387.   PRECONDITION(GetHandle());
  1388.   return ::SetFocus(GetHandle());
  1389. }
  1390.  
  1391. //
  1392. // Wrapper for Windows API.
  1393. //
  1394. inline bool
  1395. TWindow::IsWindowEnabled() const
  1396. {
  1397.   PRECONDITION(GetHandle());
  1398.   return ::IsWindowEnabled(GetHandle());
  1399. }
  1400.  
  1401. //
  1402. // Wrapper for Windows API.
  1403. //
  1404. inline bool
  1405. TWindow::EnableWindow(bool enable)
  1406. {
  1407.   PRECONDITION(GetHandle());
  1408.   return ::EnableWindow(GetHandle(), enable);
  1409. }
  1410.  
  1411. //
  1412. // Wrapper for Windows API.
  1413. //
  1414. inline void
  1415. TWindow::SetRedraw(bool redraw)
  1416. {
  1417.   PRECONDITION(GetHandle());
  1418.   SendMessage(WM_SETREDRAW, redraw);
  1419. }
  1420.  
  1421. //
  1422. // Wrapper for Windows API.
  1423. //
  1424. inline void
  1425. TWindow::ScreenToClient(TPoint& point) const
  1426. {
  1427.   PRECONDITION(GetHandle());
  1428.   ::ScreenToClient(GetHandle(), &point);
  1429. }
  1430.  
  1431. //
  1432. // Wrapper for Windows API.
  1433. //
  1434. inline void
  1435. TWindow::MapWindowPoints(HWND hWndTo, TPoint* points, int count) const
  1436. {
  1437.   PRECONDITION(GetHandle());
  1438.   ::MapWindowPoints(GetHandle(), hWndTo, points, count);
  1439. }
  1440.  
  1441. //
  1442. // Wrapper for Windows API.
  1443. //
  1444. inline TRect
  1445. TWindow::GetClientRect() const
  1446. {
  1447.   TRect  rect;
  1448.   GetClientRect(rect);
  1449.   return rect;
  1450. }
  1451.  
  1452. //
  1453. // Wrapper for Windows API.
  1454. //
  1455. inline HWND
  1456. TWindow::WindowFromPoint(const TPoint& point)
  1457. {
  1458.   return ::WindowFromPoint(point);
  1459. }
  1460.  
  1461. //
  1462. // Wrapper for Windows API.
  1463. //
  1464. inline HWND
  1465. TWindow::ChildWindowFromPoint(const TPoint& point) const
  1466. {
  1467.   PRECONDITION(GetHandle());
  1468.   return ::ChildWindowFromPoint(GetHandle(), point);
  1469. }
  1470.  
  1471. //
  1472. // Wrapper for Windows API.
  1473. //
  1474. inline void
  1475. TWindow::ClientToScreen(TPoint& point) const
  1476. {
  1477.   PRECONDITION(GetHandle());
  1478.   ::ClientToScreen(GetHandle(), &point);
  1479. }
  1480.  
  1481. //
  1482. // Wrapper for Windows API.
  1483. //
  1484. inline TRect
  1485. TWindow::GetWindowRect() const
  1486. {
  1487.   TRect  rect;
  1488.   GetWindowRect(rect);
  1489.   return rect;
  1490. }
  1491.  
  1492. //
  1493. // Wrapper for Windows API.
  1494. //
  1495. inline void
  1496. TWindow::AdjustWindowRect(TRect& rect, uint32 style, bool menu)
  1497. {
  1498.   ::AdjustWindowRect(&rect, style, menu);
  1499. }
  1500.  
  1501. //
  1502. // Wrapper for Windows API.
  1503. //
  1504. inline void
  1505. TWindow::AdjustWindowRectEx(TRect& rect, uint32 style, bool menu, uint32 exStyle)
  1506. {
  1507.   ::AdjustWindowRectEx(&rect, style, menu, exStyle);
  1508. }
  1509.  
  1510. //
  1511. // Window and class Words and Longs, window properties
  1512. //
  1513. //
  1514. inline long
  1515. TWindow::GetClassName(char far* className, int maxCount) const
  1516. {
  1517.   PRECONDITION(GetHandle());
  1518.   return ::GetClassName(GetHandle(), className, maxCount);
  1519. }
  1520.  
  1521. //
  1522. inline long
  1523. TWindow::GetClassLong(int index) const
  1524. {
  1525.   PRECONDITION(GetHandle());
  1526.   return ::GetClassLong(GetHandle(), index);
  1527. }
  1528.  
  1529. //
  1530. inline long
  1531. TWindow::SetClassLong(int index, long newLong)
  1532. {
  1533.   PRECONDITION(GetHandle());
  1534.   return ::SetClassLong(GetHandle(), index, newLong);
  1535. }
  1536.  
  1537. //
  1538. inline uint16
  1539. TWindow::GetClassWord(int index) const
  1540. {
  1541.   PRECONDITION(GetHandle());
  1542.   return ::GetClassWord(GetHandle(), index);
  1543. }
  1544.  
  1545. //
  1546. inline uint16
  1547. TWindow::SetClassWord(int index, uint16 newWord)
  1548. {
  1549.   PRECONDITION(GetHandle());
  1550.   return ::SetClassWord(GetHandle(), index, newWord);
  1551. }
  1552.  
  1553. //
  1554. inline long
  1555. TWindow::GetWindowLong(int index) const
  1556. {
  1557.   PRECONDITION(GetHandle());
  1558.   return ::GetWindowLong(GetHandle(), index);
  1559. }
  1560.  
  1561. //
  1562. inline long
  1563. TWindow::SetWindowLong(int index, long newLong)
  1564. {
  1565.   PRECONDITION(GetHandle());
  1566.   return ::SetWindowLong(GetHandle(), index, newLong);
  1567. }
  1568.  
  1569. //
  1570. inline uint16
  1571. TWindow::GetWindowWord(int index) const
  1572. {
  1573.   PRECONDITION(GetHandle());
  1574.   return ::GetWindowWord(GetHandle(), index);
  1575. }
  1576.  
  1577. //
  1578. inline uint16
  1579. TWindow::SetWindowWord(int index, uint16 newWord)
  1580. {
  1581.   PRECONDITION(GetHandle());
  1582.   return ::SetWindowWord(GetHandle(), index, newWord);
  1583. }
  1584.  
  1585. //
  1586. inline WNDPROC
  1587. TWindow::GetWindowProc() const
  1588. {
  1589.   PRECONDITION(GetHandle());
  1590.   return WNDPROC(GetWindowLong(GWL_WNDPROC));
  1591. }
  1592.  
  1593. //
  1594. inline WNDPROC
  1595. TWindow::SetWindowProc(WNDPROC wndProc)
  1596. {
  1597.   PRECONDITION(GetHandle());
  1598.   return WNDPROC(SetWindowLong(GWL_WNDPROC, long(wndProc)));
  1599. }
  1600.  
  1601. //
  1602. // Wrapper for Windows API.
  1603. //
  1604. inline int
  1605. TWindow::EnumProps(PROPENUMPROC proc)
  1606. {
  1607.   PRECONDITION(GetHandle());
  1608.   return ::EnumProps(GetHandle(), proc);
  1609. }
  1610.  
  1611. //
  1612. // Wrapper for Windows API.
  1613. //
  1614. inline HANDLE
  1615. TWindow::GetProp(uint16 atom) const
  1616. {
  1617.   PRECONDITION(GetHandle());
  1618.   return :: GetProp(GetHandle(), (LPCSTR)(uint32)atom);
  1619. }
  1620.  
  1621. //
  1622. // Wrapper for Windows API.
  1623. //
  1624. inline HANDLE
  1625. TWindow::RemoveProp(uint16 atom) const
  1626. {
  1627.   PRECONDITION(GetHandle());
  1628.   return :: RemoveProp(GetHandle(), (LPCSTR)(uint32)atom);
  1629. }
  1630.  
  1631. //
  1632. // Wrapper for Windows API.
  1633. //
  1634. inline bool
  1635. TWindow::SetProp(uint16 atom, HANDLE data) const
  1636. {
  1637.   PRECONDITION(GetHandle());
  1638.   return :: SetProp(GetHandle(), (LPCSTR)(uint32)atom, data);
  1639. }
  1640.  
  1641. //
  1642. // Wrapper for Windows API.
  1643. //
  1644. inline HANDLE
  1645. TWindow::GetProp(const char far* str) const
  1646. {
  1647.   PRECONDITION(GetHandle());
  1648.   return ::GetProp(GetHandle(), str);
  1649. }
  1650.  
  1651. //
  1652. // Wrapper for Windows API.
  1653. //
  1654. inline HANDLE
  1655. TWindow::RemoveProp(const char far* str) const
  1656. {
  1657.   PRECONDITION(GetHandle());
  1658.   return ::RemoveProp(GetHandle(), str);
  1659. }
  1660.  
  1661. //
  1662. // Wrapper for Windows API.
  1663. //
  1664. inline bool
  1665. TWindow::SetProp(const char far* str, HANDLE data) const
  1666. {
  1667.   PRECONDITION(GetHandle());
  1668.   return ::SetProp(GetHandle(), str, data);
  1669. }
  1670.  
  1671. //
  1672. // MoveWindow calls thru TWindow::SetWindowPos to allow moving before creation
  1673. //
  1674. inline bool
  1675. TWindow::MoveWindow(int x, int y, int w, int h, bool repaint)
  1676. {
  1677.   return SetWindowPos(0, x, y, w, h,
  1678.                       SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE |
  1679.                       (repaint ? 0 : SWP_NOREDRAW));
  1680. }
  1681.  
  1682. //
  1683. inline bool
  1684. TWindow::MoveWindow(const TRect& rect, bool repaint)
  1685. {
  1686.   return MoveWindow(rect.left, rect.top, rect.Width(), rect.Height(), repaint);
  1687. }
  1688.  
  1689. //
  1690. // Wrapper for Windows API.
  1691. //
  1692. inline void
  1693. TWindow::ShowOwnedPopups(bool show)
  1694. {
  1695.   PRECONDITION(GetHandle());
  1696.   ::ShowOwnedPopups(GetHandle(), show);
  1697. }
  1698.  
  1699.  
  1700. //
  1701. // Wrapper for Windows API.
  1702. //
  1703. inline bool
  1704. TWindow::IsWindowVisible() const
  1705. {
  1706.   PRECONDITION(GetHandle());
  1707.   return ::IsWindowVisible(GetHandle());
  1708. }
  1709.  
  1710. //
  1711. // Wrapper for Windows API.
  1712. //
  1713. inline bool
  1714. TWindow::IsZoomed() const
  1715. {
  1716.   PRECONDITION(GetHandle());
  1717.   return ::IsZoomed(GetHandle());
  1718. }
  1719.  
  1720. //
  1721. // Wrapper for Windows API.
  1722. //
  1723. inline bool
  1724. TWindow::IsIconic() const
  1725. {
  1726.   PRECONDITION(GetHandle());
  1727.   return ::IsIconic(GetHandle());
  1728. }
  1729.  
  1730. //
  1731. // Wrapper for Windows API.
  1732. //
  1733. inline int
  1734. TWindow::GetWindowTextLength() const
  1735. {
  1736.   PRECONDITION(GetHandle());
  1737.   return ::GetWindowTextLength(GetHandle());
  1738. }
  1739.  
  1740. //
  1741. // Wrapper for Windows API.
  1742. //
  1743. inline int
  1744. TWindow::GetWindowText(char far* str, int maxCount) const
  1745. {
  1746.   PRECONDITION(GetHandle());
  1747.   return ::GetWindowText(GetHandle(), str, maxCount);
  1748. }
  1749.  
  1750. //
  1751. // Wrapper for Windows API.
  1752. //
  1753. inline void
  1754. TWindow::SetWindowText(const char far* str)
  1755. {
  1756.   PRECONDITION(GetHandle());
  1757.   ::SetWindowText(GetHandle(), str);
  1758. }
  1759.  
  1760. //
  1761. // Wrapper for Windows API.
  1762. //
  1763. inline bool
  1764. TWindow::GetWindowPlacement(WINDOWPLACEMENT* place) const
  1765. {
  1766.   PRECONDITION(GetHandle());
  1767.   return ::GetWindowPlacement(GetHandle(), place);
  1768. }
  1769.  
  1770. //
  1771. // Wrapper for Windows API.
  1772. //
  1773. inline bool
  1774. TWindow::SetWindowPlacement(const WINDOWPLACEMENT* place)
  1775. {
  1776.   PRECONDITION(GetHandle());
  1777.   return ::SetWindowPlacement(GetHandle(), place);
  1778. }
  1779.  
  1780. //
  1781. // Wrapper for Windows API.
  1782. //
  1783. inline void
  1784. TWindow::BringWindowToTop()
  1785. {
  1786.   PRECONDITION(GetHandle());
  1787.   ::BringWindowToTop(GetHandle());
  1788. }
  1789.  
  1790. //
  1791. // Wrapper for Windows API.
  1792. //
  1793. inline HWND
  1794. TWindow::GetActiveWindow()
  1795. {
  1796.   return ::GetActiveWindow();
  1797. }
  1798.  
  1799. //
  1800. // Wrapper for Windows API.
  1801. //
  1802. inline HWND
  1803. TWindow::SetActiveWindow()
  1804. {
  1805.   PRECONDITION(GetHandle());
  1806.   return ::SetActiveWindow(GetHandle());
  1807. }
  1808.  
  1809. //
  1810. // Wrapper for Windows API.
  1811. //
  1812. inline HWND
  1813. TWindow::GetDesktopWindow()
  1814. {
  1815.   return ::GetDesktopWindow();
  1816. }
  1817.  
  1818. #if defined(BI_PLAT_WIN16)
  1819. //
  1820. // Wrapper for Windows API.
  1821. //
  1822. inline HWND
  1823. TWindow::GetSysModalWindow()
  1824. {
  1825.   return ::GetSysModalWindow();
  1826. }
  1827.  
  1828. //
  1829. // Wrapper for Windows API.
  1830. //
  1831. inline HWND
  1832. TWindow::SetSysModalWindow()
  1833. {
  1834.   PRECONDITION(GetHandle());
  1835.   return ::SetSysModalWindow(GetHandle());
  1836. }
  1837. #endif
  1838.  
  1839. //
  1840. // Wrapper for Windows API.
  1841. //
  1842. inline HWND
  1843. TWindow::GetNextWindow(uint flag) const
  1844. {
  1845.   PRECONDITION(GetHandle());
  1846. #if defined(BI_PLAT_WIN32)
  1847.   return ::GetWindow(GetHandle(), flag);
  1848. #else
  1849.   return ::GetNextWindow(GetHandle(), flag);
  1850. #endif
  1851. }
  1852.  
  1853. //
  1854. // Wrapper for Windows API.
  1855. //
  1856. inline HWND
  1857. TWindow::GetLastActivePopup() const
  1858. {
  1859.   PRECONDITION(GetHandle());
  1860.   return ::GetLastActivePopup(GetHandle());
  1861. }
  1862.  
  1863. //
  1864. // Wrapper for Windows API.
  1865. //
  1866. inline HWND
  1867. TWindow::GetWindow(uint flag) const
  1868. {
  1869. //  PRECONDITION(GetHandle());
  1870.   return ::GetWindow(GetHandle(), flag);
  1871. }
  1872.  
  1873. //
  1874. // Wrapper for Windows API.
  1875. //
  1876. inline HWND
  1877. TWindow::GetTopWindow() const
  1878. {
  1879.   PRECONDITION(GetHandle());
  1880.   return ::GetTopWindow(GetHandle());
  1881. }
  1882.  
  1883. //
  1884. inline bool
  1885. TWindow::SetWindowPos(HWND hWndInsertAfter, const TRect& rect, uint flags)
  1886. {
  1887.   return SetWindowPos(hWndInsertAfter,
  1888.                       rect.left, rect.top, rect.Width(), rect.Height(), flags);
  1889. }
  1890.  
  1891. //
  1892. // Wrapper for Windows API.
  1893. //
  1894. inline void
  1895. TWindow::Invalidate(bool erase)
  1896. {
  1897.   PRECONDITION(GetHandle());
  1898.   ::InvalidateRect(GetHandle(), 0, erase);
  1899. }
  1900.  
  1901. //
  1902. // Wrapper for Windows API.
  1903. //
  1904. inline void
  1905. TWindow::InvalidateRect(const TRect& rect, bool erase)
  1906. {
  1907.   PRECONDITION(GetHandle());
  1908.   ::InvalidateRect(GetHandle(), &rect, erase);
  1909. }
  1910.  
  1911. //
  1912. // Wrapper for Windows API.
  1913. //
  1914. inline void
  1915. TWindow::InvalidateRgn(HRGN hRgn, bool erase)
  1916. {
  1917.   PRECONDITION(GetHandle());
  1918.   ::InvalidateRgn(GetHandle(), hRgn, erase);
  1919. }
  1920.  
  1921. //
  1922. // Wrapper for Windows API.
  1923. //
  1924. inline void
  1925. TWindow::Validate()
  1926. {
  1927.   PRECONDITION(GetHandle());
  1928.   ::ValidateRect(GetHandle(), 0);
  1929. }
  1930.  
  1931. //
  1932. // Wrapper for Windows API.
  1933. //
  1934. inline void
  1935. TWindow::ValidateRect(const TRect& rect)
  1936. {
  1937.   PRECONDITION(GetHandle());
  1938.   ::ValidateRect(GetHandle(), &rect);
  1939. }
  1940.  
  1941. //
  1942. // Wrapper for Windows API.
  1943. //
  1944. inline void
  1945. TWindow::ValidateRgn(HRGN hRgn)
  1946. {
  1947.   PRECONDITION(GetHandle());
  1948.   ::ValidateRgn(GetHandle(), hRgn);
  1949. }
  1950.  
  1951. //
  1952. // Wrapper for Windows API.
  1953. //
  1954. inline void
  1955. TWindow::UpdateWindow()
  1956. {
  1957.   PRECONDITION(GetHandle());
  1958.   ::UpdateWindow(GetHandle());
  1959. }
  1960.  
  1961. //
  1962. // Wrapper for Windows API.
  1963. //
  1964. inline bool
  1965. TWindow::FlashWindow(bool invert)
  1966. {
  1967.   PRECONDITION(GetHandle());
  1968.   return ::FlashWindow(GetHandle(), invert);
  1969. }
  1970.  
  1971. //
  1972. // Wrapper for Windows API.
  1973. //
  1974. inline bool
  1975. TWindow::GetUpdateRect(TRect& rect, bool erase) const
  1976. {
  1977.   PRECONDITION(GetHandle());
  1978.   return ::GetUpdateRect(GetHandle(), &rect, erase);
  1979. }
  1980.  
  1981. //
  1982. // Wrapper for Windows API.
  1983. //
  1984. inline bool
  1985. TWindow::LockWindowUpdate()
  1986. {
  1987.   PRECONDITION(GetHandle());
  1988.   return ::LockWindowUpdate(GetHandle());
  1989. }
  1990.  
  1991. //
  1992. // Wrapper for Windows API.
  1993. //
  1994. inline bool
  1995. TWindow::RedrawWindow(TRect* update, HRGN hUpdateRgn, uint redraw)
  1996. {
  1997.   PRECONDITION(GetHandle());
  1998.   return ::RedrawWindow(GetHandle(), update, hUpdateRgn, redraw);
  1999. }
  2000.  
  2001. //
  2002. // Wrapper for Windows API.
  2003. //
  2004. inline bool
  2005. TWindow::EnableScrollBar(uint sbFlags, uint arrowFlags)
  2006. {
  2007.   PRECONDITION(GetHandle());
  2008.   return ::EnableScrollBar(GetHandle(), sbFlags, arrowFlags);
  2009. }
  2010.  
  2011. //
  2012. // Wrapper for Windows API.
  2013. //
  2014. inline void TWindow::ShowScrollBar(int bar, bool show)
  2015. {
  2016.   PRECONDITION(GetHandle());
  2017.   ::ShowScrollBar(GetHandle(), bar, show);
  2018. }
  2019.  
  2020. //
  2021. // Wrapper for Windows API.
  2022. //
  2023. inline void
  2024. TWindow::ScrollWindow(int              dx,
  2025.                       int              dy,
  2026.                       const TRect far* scroll,
  2027.                       const TRect far* clip)
  2028. {
  2029.   PRECONDITION(GetHandle());
  2030.   ::ScrollWindow(GetHandle(), dx, dy, scroll, clip);
  2031. }
  2032.  
  2033. //
  2034. // Wrapper for Windows API.
  2035. //
  2036. inline void
  2037. TWindow::ScrollWindowEx(int              dx,
  2038.                         int              dy,
  2039.                         const TRect far* scroll,
  2040.                         const TRect far* clip,
  2041.                         HRGN             hUpdateRgn,
  2042.                         TRect far*       update,
  2043.                         uint             flags)
  2044. {
  2045.   PRECONDITION(GetHandle());
  2046.   ::ScrollWindowEx(GetHandle(), dx, dy, scroll, clip, hUpdateRgn, update, flags);
  2047. }
  2048.  
  2049. //
  2050. // Wrapper for Windows API.
  2051. //
  2052. inline int
  2053. TWindow::GetDlgCtrlID() const
  2054. {
  2055.   PRECONDITION(GetHandle());
  2056.   return ::GetDlgCtrlID(GetHandle());
  2057. }
  2058.  
  2059. //
  2060. // Wrapper for Windows API.
  2061. //
  2062. inline HWND
  2063. TWindow::GetDlgItem(int childId) const
  2064. {
  2065.   PRECONDITION(GetHandle());
  2066.   return ::GetDlgItem(GetHandle(), childId);
  2067. }
  2068.  
  2069. //
  2070. // Wrapper for Windows API.
  2071. //
  2072. inline void
  2073. TWindow::SetDlgItemInt(int childId, uint value, bool isSigned) const
  2074. {
  2075.   PRECONDITION(GetHandle());
  2076.   ::SetDlgItemInt(GetHandle(), childId, value, isSigned);
  2077. }
  2078.  
  2079. //
  2080. // Wrapper for Windows API.
  2081. //
  2082. inline int
  2083. TWindow::GetDlgItemText(int childId, char far* text, int max) const
  2084. {
  2085.   PRECONDITION(GetHandle());
  2086.   return ::GetDlgItemText(GetHandle(), childId, text, max);
  2087. }
  2088.  
  2089. //
  2090. // Wrapper for Windows API.
  2091. //
  2092. inline void
  2093. TWindow::SetDlgItemText(int childId, const char far* text) const
  2094. {
  2095.   PRECONDITION(GetHandle());
  2096.   ::SetDlgItemText(GetHandle(), childId, text);
  2097. }
  2098.  
  2099. //
  2100. // Wrapper for Windows API.
  2101. //
  2102. inline uint
  2103. TWindow::IsDlgButtonChecked(int buttonId) const
  2104. {
  2105.   PRECONDITION(GetHandle());
  2106.   return ::IsDlgButtonChecked(GetHandle(), buttonId);
  2107. }
  2108.  
  2109. //
  2110. // Wrapper for Windows API.
  2111. //
  2112. inline bool
  2113. TWindow::IsChild(HWND hWnd) const
  2114. {
  2115.   PRECONDITION(GetHandle());
  2116.   return ::IsChild(GetHandle(), hWnd);
  2117. }
  2118.  
  2119. //
  2120. // Wrapper for Windows API.
  2121. //
  2122. inline HWND
  2123. TWindow::GetNextDlgGroupItem(HWND hWndCtrl, bool previous) const
  2124. {
  2125.   PRECONDITION(GetHandle());
  2126.   return ::GetNextDlgGroupItem(GetHandle(), hWndCtrl, previous);
  2127. }
  2128.  
  2129. //
  2130. // Wrapper for Windows API.
  2131. //
  2132. inline HWND
  2133. TWindow::GetNextDlgTabItem(HWND hWndCtrl, bool previous) const
  2134. {
  2135.   PRECONDITION(GetHandle());
  2136.   return ::GetNextDlgTabItem(GetHandle(), hWndCtrl, previous);
  2137. }
  2138.  
  2139. //
  2140. // Wrapper for Windows API.
  2141. //
  2142. inline void
  2143. TWindow::CheckDlgButton(int buttonId, uint check)
  2144. {
  2145.   PRECONDITION(GetHandle());
  2146.   ::CheckDlgButton(GetHandle(), buttonId, check);
  2147. }
  2148.  
  2149. //
  2150. // Wrapper for Windows API.
  2151. //
  2152. inline void
  2153. TWindow::CheckRadioButton(int firstButtonId, int lastButtonId, int checkButtonId)
  2154. {
  2155.   PRECONDITION(GetHandle());
  2156.   ::CheckRadioButton(GetHandle(), firstButtonId, lastButtonId, checkButtonId);
  2157. }
  2158.  
  2159. //
  2160. // Wrapper for Windows API.
  2161. //
  2162. inline HMENU
  2163. TWindow::GetMenu() const
  2164. {
  2165.   PRECONDITION(GetHandle());
  2166.   return ::GetMenu(GetHandle());
  2167. }
  2168.  
  2169. //
  2170. // Wrapper for Windows API.
  2171. //
  2172. inline HMENU
  2173. TWindow::GetSystemMenu(bool revert) const
  2174. {
  2175.   PRECONDITION(GetHandle());
  2176.   return ::GetSystemMenu(GetHandle(), revert);
  2177. }
  2178.  
  2179. //
  2180. // Return the associated popup menu used by the window.
  2181. //
  2182. inline TPopupMenu*
  2183. TWindow::GetContextMenu() const
  2184. {
  2185.   return ContextPopupMenu;
  2186. }
  2187.  
  2188. //
  2189. // Wrapper for Windows API.
  2190. //
  2191. inline bool
  2192. TWindow::SetMenu(HMENU hMenu)
  2193. {
  2194.   PRECONDITION(GetHandle());
  2195.   return ::SetMenu(GetHandle(), hMenu);
  2196. }
  2197.  
  2198. //
  2199. // Wrapper for Windows API.
  2200. //
  2201. inline bool
  2202. TWindow::HiliteMenuItem(HMENU hMenu, uint idItem, uint hilite)
  2203. {
  2204.   PRECONDITION(GetHandle());
  2205.   return ::HiliteMenuItem(GetHandle(), hMenu, idItem, hilite);
  2206. }
  2207.  
  2208. //
  2209. // Wrapper for Windows API.
  2210. //
  2211. inline void
  2212. TWindow::DrawMenuBar()
  2213. {
  2214.   PRECONDITION(GetHandle());
  2215.   ::DrawMenuBar(GetHandle());
  2216. }
  2217.  
  2218. //
  2219. // Wrapper for Windows API.
  2220. //
  2221. inline bool
  2222. TWindow::KillTimer(uint timerId)
  2223. {
  2224.   return ::KillTimer(GetHandle(), timerId);
  2225. }
  2226.  
  2227. //
  2228. // Wrapper for Windows API.
  2229. //
  2230. inline uint
  2231. TWindow::SetTimer(uint timerId, uint timeout, TIMERPROC proc)
  2232. {
  2233.   return ::SetTimer(GetHandle(), timerId, timeout, proc);
  2234. }
  2235.  
  2236. //
  2237. // Wrapper for Windows API.
  2238. //
  2239. inline void
  2240. TWindow::CreateCaret(HBITMAP hBitmap)
  2241. {
  2242.   PRECONDITION(GetHandle());
  2243.   ::CreateCaret(GetHandle(), hBitmap, 0, 0);
  2244. }
  2245.  
  2246. //
  2247. // Wrapper for Windows API.
  2248. //
  2249. inline void
  2250. TWindow::CreateCaret(bool isGray, int width, int height)
  2251. {
  2252.   PRECONDITION(GetHandle());
  2253.   ::CreateCaret(GetHandle(), (HBITMAP)(isGray ? 1 : 0), width, height);
  2254. }
  2255.  
  2256. //
  2257. // Wrapper for Windows API.
  2258. //
  2259. inline void
  2260. TWindow::DestroyCaret()
  2261. {
  2262.   ::DestroyCaret();
  2263. }
  2264.  
  2265. //
  2266. // Wrapper for Windows API.
  2267. //
  2268. inline uint
  2269. TWindow::GetCaretBlinkTime()
  2270. {
  2271.   return ::GetCaretBlinkTime();
  2272. }
  2273.  
  2274. //
  2275. // Wrapper for Windows API.
  2276. //
  2277. inline void
  2278. TWindow::GetCaretPos(TPoint& point)
  2279. {
  2280.   ::GetCaretPos(&point);
  2281. }
  2282.  
  2283. //
  2284. // Wrapper for Windows API.
  2285. //
  2286. inline void
  2287. TWindow::HideCaret()
  2288. {
  2289.   PRECONDITION(GetHandle());
  2290.   ::HideCaret(GetHandle());
  2291. }
  2292.  
  2293. //
  2294. // Wrapper for Windows API.
  2295. //
  2296. inline void
  2297. TWindow::SetCaretBlinkTime(uint16 milliSecs)
  2298. {
  2299.   ::SetCaretBlinkTime(milliSecs);
  2300. }
  2301.  
  2302. //
  2303. // Wrapper for Windows API.
  2304. //
  2305. inline void
  2306. TWindow::SetCaretPos(int x, int y)
  2307. {
  2308.   ::SetCaretPos(x, y);
  2309. }
  2310.  
  2311. //
  2312. // Wrapper for Windows API.
  2313. //
  2314. inline void
  2315. TWindow::SetCaretPos(const TPoint& pos)
  2316. {
  2317.   ::SetCaretPos(pos.x, pos.y);
  2318. }
  2319.  
  2320. //
  2321. // Wrapper for Windows API.
  2322. //
  2323. inline void
  2324. TWindow::ShowCaret()
  2325. {
  2326.   PRECONDITION(GetHandle());
  2327.   ::ShowCaret(GetHandle());
  2328. }
  2329.  
  2330. //
  2331. // Wrapper for Windows API.
  2332. //
  2333. inline void
  2334. TWindow::GetCursorPos(TPoint& pos)
  2335. {
  2336.   ::GetCursorPos(&pos);
  2337. }
  2338.  
  2339. //
  2340. // Wrapper for Windows API.
  2341. //
  2342. inline void
  2343. TWindow::SetWindowFont(HFONT font, bool redraw)
  2344. {
  2345.   PRECONDITION(GetHandle());
  2346.   SendMessage(WM_SETFONT, TParam1(font), redraw);
  2347. }
  2348.  
  2349. //
  2350. // Wrapper for Windows API.
  2351. //
  2352. inline HFONT
  2353. TWindow::GetWindowFont()
  2354. {
  2355.   PRECONDITION(GetHandle());
  2356.   return (HFONT)SendMessage(WM_GETFONT);
  2357. }
  2358.  
  2359. #if defined(BI_PLAT_WIN32)
  2360. //
  2361. inline bool
  2362. TWindow::RegisterHotKey(int idHotKey, uint modifiers, uint virtKey)
  2363. {
  2364.   PRECONDITION(GetHandle());
  2365.   return ::RegisterHotKey(GetHandle(), idHotKey, modifiers, virtKey);
  2366. }
  2367.  
  2368. //
  2369. inline bool
  2370. TWindow::UnregisterHotKey(int idHotKey)
  2371. {
  2372.   PRECONDITION(GetHandle());
  2373.   return ::UnregisterHotKey(GetHandle(), idHotKey);
  2374. }
  2375. #endif
  2376.  
  2377. //
  2378. // Wrapper for Windows API.
  2379. //
  2380. inline bool
  2381. TWindow::WinHelp(const char far* helpFile, uint command, uint32 data)
  2382. {
  2383.   PRECONDITION(GetHandle());
  2384.   return ::WinHelp(GetHandle(), helpFile, command, data);
  2385. }
  2386.  
  2387. //
  2388. inline int
  2389. TWindow::MessageBox(const char far* text,
  2390.                     const char far* caption,
  2391.                     uint            type)
  2392. {
  2393.   PRECONDITION(GetApplication());
  2394.   PRECONDITION(GetHandle());
  2395.   return GetApplication()->MessageBox(*this, text, caption, type);
  2396. }
  2397.  
  2398. //
  2399. // Wrapper for Windows API.
  2400. //
  2401. inline HTASK
  2402. TWindow::GetWindowTask() const
  2403. {
  2404.   PRECONDITION(GetHandle());
  2405. #if defined(BI_PLAT_WIN32)
  2406.   return (HANDLE)::GetWindowThreadProcessId(GetHandle(), 0);
  2407. #else
  2408.   return ::GetWindowTask(GetHandle());
  2409. #endif
  2410. }
  2411.  
  2412. //
  2413. // Wrapper for Windows API.
  2414. //
  2415. inline void
  2416. TWindow::DragAcceptFiles(bool accept)
  2417. {
  2418.   PRECONDITION(GetHandle());
  2419.   ::DragAcceptFiles(GetHandle(), accept);
  2420. }
  2421.  
  2422. //
  2423. inline TWindow* TWindow::GetWindowPtr(HWND hWnd) const
  2424. {
  2425. #if defined(BI_NAMESPACE)
  2426.   return OWL::GetWindowPtr(hWnd, GetApplication());
  2427. #else
  2428.   return ::GetWindowPtr(hWnd, GetApplication());
  2429. #endif
  2430. }
  2431.  
  2432. //
  2433. // Inline member functions that call DefWindowProc()
  2434. //
  2435.  
  2436. //
  2437. inline void TWindow::EvActivate(uint /*active*/,
  2438.                                 bool /*minimized*/,
  2439.                                 HWND /*hWndOther*//*may be 0*/)
  2440. {
  2441.   DefaultProcessing();
  2442. }
  2443.  
  2444. //
  2445. inline void TWindow::EvActivateApp(bool /*active*/, HTASK /*hTask or threadId*/)
  2446. {
  2447.   DefaultProcessing();
  2448. }
  2449.  
  2450. //
  2451. inline void TWindow::EvAskCBFormatName(uint /*bufLen*/, char far* /*buffer*/)
  2452. {
  2453.   DefaultProcessing();
  2454. }
  2455.  
  2456. //
  2457. inline void TWindow::EvCancelMode()
  2458. {
  2459.   DefaultProcessing();
  2460. }
  2461.  
  2462. //
  2463. inline void TWindow::EvChangeCBChain(HWND /*hWndRemoved*/, HWND /*hWndNext*/)
  2464. {
  2465.   DefaultProcessing();
  2466. }
  2467.  
  2468. //
  2469. inline void TWindow::EvChar(uint /*key*/, uint /*repeatCount*/, uint /*flags*/)
  2470. {
  2471.   DefaultProcessing();
  2472. }
  2473.  
  2474. //
  2475. inline int TWindow::EvCharToItem(uint /*key*/, HWND /*hWndListBox*/, uint /*caretPos*/)
  2476. {
  2477.   return (int)DefaultProcessing();
  2478. }
  2479.  
  2480. //
  2481. inline int TWindow::EvVKeyToItem(uint /*key*/, HWND /*hWndListBox*/, uint /*caretPos*/)
  2482. {
  2483.   return (int)DefaultProcessing();
  2484. }
  2485.  
  2486. //
  2487. inline void TWindow::EvCommNotify(uint /*commId*/, uint /*status*/)
  2488. {
  2489.   DefaultProcessing();
  2490. }
  2491.  
  2492. //
  2493. inline void TWindow::EvCompacting(uint /*compactRatio*/)
  2494. {
  2495.   DefaultProcessing();
  2496. }
  2497.  
  2498. #if defined(BI_PLAT_WIN32)
  2499. //
  2500. inline void TWindow::EvCopyData(HWND /*hwnd*/, COPYDATASTRUCT* /*dataStruct*/)
  2501. {
  2502.   DefaultProcessing();
  2503. }
  2504. #endif
  2505.  
  2506.  
  2507. //
  2508. inline void TWindow::EvDeadChar(uint /*deadKey*/, uint /*repeatCount*/, uint /*flags*/)
  2509. {
  2510.   DefaultProcessing();
  2511. }
  2512.  
  2513. //
  2514. inline void TWindow::EvDestroyClipboard()
  2515. {
  2516.   DefaultProcessing();
  2517. }
  2518.  
  2519. //
  2520. inline void TWindow::EvDevModeChange(char far* /*device*/)
  2521. {
  2522.   DefaultProcessing();
  2523. }
  2524.  
  2525. //
  2526. inline void TWindow::EvDropFiles(TDropInfo)
  2527. {
  2528.   DefaultProcessing();
  2529. }
  2530.  
  2531. //
  2532. inline void TWindow::EvDrawClipboard()
  2533. {
  2534.   DefaultProcessing();
  2535. }
  2536.  
  2537. //
  2538. inline void TWindow::EvEnable(bool /*enabled*/)
  2539. {
  2540.   DefaultProcessing();
  2541. }
  2542.  
  2543. //
  2544. inline void TWindow::EvFontChange()
  2545. {
  2546.   DefaultProcessing();
  2547. }
  2548.  
  2549. //
  2550. inline uint TWindow::EvGetDlgCode(MSG far*)
  2551. {
  2552.   return (uint)DefaultProcessing();
  2553. }
  2554.  
  2555. //
  2556. inline HFONT   TWindow::EvGetFont()
  2557. {
  2558.   return (HFONT)DefaultProcessing();
  2559. }
  2560.  
  2561. //
  2562. inline void TWindow::EvGetMinMaxInfo(MINMAXINFO far& /*info*/)
  2563. {
  2564.   DefaultProcessing();
  2565. }
  2566.  
  2567. //
  2568. inline void TWindow::EvGetText(uint /*buffSize*/, char far* /*buff*/)
  2569. {
  2570.   DefaultProcessing();
  2571. }
  2572.  
  2573. //
  2574. inline uint TWindow::EvGetTextLength()
  2575. {
  2576.   return (uint)DefaultProcessing();
  2577. }
  2578.  
  2579. //
  2580. inline void TWindow::EvHotKey(int /*idHotKey*/)
  2581. {
  2582.   DefaultProcessing();
  2583. }
  2584.  
  2585. //
  2586. inline void TWindow::EvInputFocus(bool /*gainingFocus*/)
  2587. {
  2588.   DefaultProcessing();
  2589. }
  2590.  
  2591. //
  2592. inline void TWindow::EvHScrollClipboard(HWND /*hWndCBViewer*/,
  2593.                                            uint /*scrollCode*/,
  2594.                                            uint /*pos*/)
  2595. {
  2596.   DefaultProcessing();
  2597. }
  2598.  
  2599. //
  2600. inline void TWindow::EvIconEraseBkgnd(HDC /*dc*/)
  2601. {
  2602.   DefaultProcessing();
  2603. }
  2604.  
  2605. //
  2606. inline void TWindow::EvInitMenu(HMENU /*menu*/)
  2607. {
  2608.   DefaultProcessing();
  2609. }
  2610.  
  2611. //
  2612. inline void TWindow::EvKeyDown(uint /*key*/, uint /*repeatCount*/, uint /*flags*/)
  2613. {
  2614.   DefaultProcessing();
  2615. }
  2616.  
  2617. //
  2618. inline void TWindow::EvKeyUp(uint /*key*/, uint /*repeatCount*/, uint /*flags*/)
  2619. {
  2620.   DefaultProcessing();
  2621. }
  2622.  
  2623. //
  2624. inline void TWindow::EvLButtonDblClk(uint /*modKeys*/, TPoint&)
  2625. {
  2626.   DefaultProcessing();
  2627. }
  2628.  
  2629. //
  2630. inline void TWindow::EvLButtonUp(uint /*modKeys*/, TPoint&)
  2631. {
  2632.   DefaultProcessing();
  2633. }
  2634.  
  2635. //
  2636. inline void TWindow::EvMButtonDblClk(uint /*modKeys*/, TPoint&)
  2637. {
  2638.   DefaultProcessing();
  2639. }
  2640.  
  2641. //
  2642. inline void TWindow::EvMButtonDown(uint /*modKeys*/, TPoint&)
  2643. {
  2644.   DefaultProcessing();
  2645. }
  2646.  
  2647. //
  2648. inline void TWindow::EvMButtonUp(uint /*modKeys*/, TPoint&)
  2649. {
  2650.   DefaultProcessing();
  2651. }
  2652.  
  2653. //
  2654. inline int32   TWindow::EvMenuChar(uint /*nChar*/, uint /*menuType*/, HMENU /*hMenu*/)
  2655. {
  2656.   return (uint)DefaultProcessing();
  2657. }
  2658.  
  2659. //
  2660. inline void TWindow::EvMenuSelect(uint /*menuItemId*/, uint /*flags*/, HMENU /*hMenu*/)
  2661. {
  2662.   DefaultProcessing();
  2663. }
  2664.  
  2665. //
  2666. inline uint TWindow::EvMouseActivate(HWND /*hWndTopLevel*/, uint /*hitTestCode*/, uint /*msg*/)
  2667. {
  2668.   return (uint)DefaultProcessing();
  2669. }
  2670.  
  2671. //
  2672. inline void TWindow::EvMouseMove(uint /*modKeys*/, TPoint&)
  2673. {
  2674.   DefaultProcessing();
  2675. }
  2676.  
  2677. //
  2678. inline bool TWindow::EvNCActivate(bool /*active*/)
  2679. {
  2680.   return (bool)DefaultProcessing();
  2681. }
  2682.  
  2683. //
  2684. inline uint TWindow::EvNCCalcSize(bool /*calcValidRects*/, NCCALCSIZE_PARAMS far&)
  2685. {
  2686.   return (uint)DefaultProcessing();
  2687. }
  2688.  
  2689. //
  2690. inline bool TWindow::EvNCCreate(CREATESTRUCT far&)
  2691. {
  2692.   return (bool)DefaultProcessing();
  2693. }
  2694.  
  2695. //
  2696. inline uint TWindow::EvNCHitTest(TPoint&)
  2697. {
  2698.   return (uint)DefaultProcessing();
  2699. }
  2700.  
  2701. //
  2702. inline void TWindow::EvNCLButtonDblClk(uint /*hitTest*/, TPoint&)
  2703. {
  2704.   DefaultProcessing();
  2705. }
  2706.  
  2707. //
  2708. inline void TWindow::EvNCLButtonDown(uint /*hitTest*/, TPoint&)
  2709. {
  2710.   DefaultProcessing();
  2711. }
  2712.  
  2713. //
  2714. inline void TWindow::EvNCLButtonUp(uint /*hitTest*/, TPoint&)
  2715. {
  2716.   DefaultProcessing();
  2717. }
  2718.  
  2719. //
  2720. inline void TWindow::EvNCMButtonDblClk(uint /*hitTest*/, TPoint&)
  2721. {
  2722.   DefaultProcessing();
  2723. }
  2724.  
  2725. //
  2726. inline void TWindow::EvNCMButtonDown(uint /*hitTest*/, TPoint&)
  2727. {
  2728.   DefaultProcessing();
  2729. }
  2730.  
  2731. //
  2732. inline void TWindow::EvNCMButtonUp(uint /*hitTest*/, TPoint&)
  2733. {
  2734.   DefaultProcessing();
  2735. }
  2736.  
  2737. //
  2738. inline void TWindow::EvNCMouseMove(uint /*hitTest*/, TPoint&)
  2739. {
  2740.   DefaultProcessing();
  2741. }
  2742.  
  2743. #if defined(BI_PLAT_WIN32)
  2744. //
  2745. inline void TWindow::EvNCPaint(HRGN /*region*/)
  2746. {
  2747.   DefaultProcessing();
  2748. }
  2749. #else
  2750. //
  2751. inline void TWindow::EvNCPaint()
  2752. {
  2753.   DefaultProcessing();
  2754. }
  2755. #endif //BI_PLAT_WIN32
  2756.  
  2757. //
  2758. inline void TWindow::EvNCRButtonDblClk(uint /*hitTest*/, TPoint&)
  2759. {
  2760.   DefaultProcessing();
  2761. }
  2762.  
  2763. //
  2764. inline void TWindow::EvNCRButtonDown(uint /*hitTest*/, TPoint&)
  2765. {
  2766.   DefaultProcessing();
  2767. }
  2768.  
  2769. //
  2770. inline void TWindow::EvNCRButtonUp(uint /*hitTest*/, TPoint&)
  2771. {
  2772.   DefaultProcessing();
  2773. }
  2774.  
  2775. //
  2776. inline void TWindow::EvNextDlgCtl(uint /*hctlOrDir*/, uint /*isHCtl*/)
  2777. {
  2778.   DefaultProcessing();
  2779. }
  2780.  
  2781. //
  2782. inline void TWindow::EvOtherWindowCreated(HWND /*hWndOther*/)
  2783. {
  2784.   DefaultProcessing();
  2785. }
  2786.  
  2787. //
  2788. inline void TWindow::EvOtherWindowDestroyed(HWND /*hWndOther*/)
  2789. {
  2790.   DefaultProcessing();
  2791. }
  2792.  
  2793. //
  2794. inline void TWindow::EvPaintIcon()
  2795. {
  2796.   DefaultProcessing();
  2797. }
  2798.  
  2799. //
  2800. inline void TWindow::EvPaintClipboard(HWND, HANDLE /*hPaintStruct*/)
  2801. {
  2802.   DefaultProcessing();
  2803. }
  2804.  
  2805. //
  2806. inline void TWindow::EvPaletteChanged(HWND /*hWndPalChg*/)
  2807. {
  2808.   DefaultProcessing();
  2809. }
  2810.  
  2811. //
  2812. inline void TWindow::EvPaletteIsChanging(HWND /*hWndPalChg*/)
  2813. {
  2814.   DefaultProcessing();
  2815. }
  2816.  
  2817. //
  2818. inline void TWindow::EvParentNotify(uint /*event*/, uint /*hChildOrX*/, uint /*childIDOrY*/)
  2819. {
  2820.   DefaultProcessing();
  2821. }
  2822.  
  2823. //
  2824. inline int  TWindow::EvPower(uint)
  2825. {
  2826.   return (int)DefaultProcessing();
  2827. }
  2828.  
  2829. //
  2830. inline void TWindow::EvSysCommand(uint /*cmdType*/, TPoint&)
  2831. {
  2832.   DefaultProcessing();
  2833. }
  2834.  
  2835. //
  2836. inline HANDLE  TWindow::EvQueryDragIcon()
  2837. {
  2838.   return (HANDLE)DefaultProcessing();
  2839. }
  2840.  
  2841. //
  2842. inline bool TWindow::EvQueryNewPalette()
  2843. {
  2844.   return (bool)DefaultProcessing();
  2845. }
  2846.  
  2847. //
  2848. inline bool TWindow::EvQueryOpen()
  2849. {
  2850.   return (bool)DefaultProcessing();
  2851. }
  2852.  
  2853. //
  2854. inline void TWindow::EvQueueSync()
  2855. {
  2856.   DefaultProcessing();
  2857. }
  2858.  
  2859. //
  2860. inline void TWindow::EvRenderAllFormats()
  2861. {
  2862.   DefaultProcessing();
  2863. }
  2864.  
  2865. //
  2866. inline void TWindow::EvRenderFormat(uint /*dataFormat*/)
  2867. {
  2868.   DefaultProcessing();
  2869. }
  2870.  
  2871. //
  2872. inline void TWindow::EvRButtonDblClk(uint /*modKeys*/, TPoint&)
  2873. {
  2874.   DefaultProcessing();
  2875. }
  2876.  
  2877. //
  2878. inline void TWindow::EvRButtonDown(uint /*modKeys*/, TPoint&)
  2879. {
  2880.   DefaultProcessing();
  2881. }
  2882.  
  2883. //
  2884. inline void TWindow::EvRButtonUp(uint /*modKeys*/, TPoint&)
  2885. {
  2886.   DefaultProcessing();
  2887. }
  2888.  
  2889. //
  2890. inline void TWindow::EvSetFocus(HWND /*hWndLostFocus*/)
  2891. {
  2892.   DefaultProcessing();
  2893. }
  2894.  
  2895. //
  2896. inline void TWindow::EvSetFont(HFONT, bool)
  2897. {
  2898.   DefaultProcessing();
  2899. }
  2900.  
  2901. //
  2902. inline void TWindow::EvSetRedraw(bool)
  2903. {
  2904.   DefaultProcessing();
  2905. }
  2906.  
  2907. //
  2908. inline void TWindow::EvSetText(const char far*)
  2909. {
  2910.   DefaultProcessing();
  2911. }
  2912.  
  2913. //
  2914. inline void TWindow::EvShowWindow(bool /*show*/, uint /*status*/)
  2915. {
  2916.   DefaultProcessing();
  2917. }
  2918.  
  2919. //
  2920. inline void TWindow::EvSizeClipboard(HWND /*hWndViewer*/, HANDLE /*hRect*/)
  2921. {
  2922.   DefaultProcessing();
  2923. }
  2924.  
  2925. //
  2926. inline void TWindow::EvSpoolerStatus(uint /*jobStatus*/, uint /*jobsLeft*/)
  2927. {
  2928.   DefaultProcessing();
  2929. }
  2930.  
  2931. //
  2932. inline void TWindow::EvSysChar(uint /*key*/, uint /*repeatCount*/, uint /*flags*/)
  2933. {
  2934.   DefaultProcessing();
  2935. }
  2936.  
  2937. //
  2938. inline void TWindow::EvSysDeadChar(uint /*key*/, uint /*repeatCount*/, uint /*flags*/)
  2939. {
  2940.   DefaultProcessing();
  2941. }
  2942.  
  2943. //
  2944. inline void TWindow::EvSysKeyDown(uint /*key*/, uint /*repeatCount*/, uint /*flags*/)
  2945. {
  2946.   DefaultProcessing();
  2947. }
  2948.  
  2949. //
  2950. inline void TWindow::EvSysKeyUp(uint /*key*/, uint /*repeatCount*/, uint /*flags*/)
  2951. {
  2952.   DefaultProcessing();
  2953. }
  2954.  
  2955. //
  2956. inline void TWindow::EvSystemError(uint /*error*/)
  2957. {
  2958.   DefaultProcessing();
  2959. }
  2960.  
  2961. //
  2962. inline void TWindow::EvTimeChange()
  2963. {
  2964.   DefaultProcessing();
  2965. }
  2966.  
  2967. //
  2968. inline void TWindow::EvTimer(uint /*timerId*/)
  2969. {
  2970.   DefaultProcessing();
  2971. }
  2972.  
  2973. //
  2974. inline void TWindow::EvWinIniChange(char far* /*section*/)
  2975. {
  2976.   DefaultProcessing();
  2977. }
  2978.  
  2979. //
  2980. inline void TWindow::EvVScrollClipboard(HWND /*hWndCBViewer*/,
  2981.                                            uint /*scrollCode*/,
  2982.                                            uint /*pos*/)
  2983. {
  2984.   DefaultProcessing();
  2985. }
  2986.  
  2987. //
  2988. inline void TWindow::EvWindowPosChanged(WINDOWPOS far& /*windowPos*/)
  2989. {
  2990.   DefaultProcessing();
  2991. }
  2992.  
  2993. //
  2994. inline void TWindow::EvWindowPosChanging(WINDOWPOS far& /*windowPos*/)
  2995. {
  2996.   DefaultProcessing();
  2997. }
  2998.  
  2999. #if defined(OWL2_COMPAT)
  3000. //
  3001. // Show() is just a synonym for ShowWindow() for OWL 1 compatibility
  3002. //
  3003. inline void
  3004. TWindow::Show(int cmdShow)
  3005. {
  3006.   ShowWindow(cmdShow);
  3007. }
  3008.  
  3009. //
  3010. inline TClipboard&
  3011. TWindow::OpenClipboard()
  3012. {
  3013.   PRECONDITION(GetHandle());
  3014.  
  3015.   TClipboard& clip = TClipboard::GetClipboard();
  3016.  
  3017.   clip.OpenClipboard(GetHandle());
  3018.   return clip;
  3019. }
  3020. #endif
  3021.  
  3022. #endif  // OWL_WINDOW_H
  3023.